@firestone-hs/simulate-bgs-battle 1.1.716 → 1.1.717

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.
@@ -1 +1 @@
1
- {"version":3,"file":"shifting-tide.js","sourceRoot":"","sources":["../../../../src/cards/impl/bg-spell/shifting-tide.ts"],"names":[],"mappings":";;;AAAA,iEAAoD;AAEpD,qDAAwD;AACxD,0CAA0E;AAI1E,MAAM,yBAAyB,GAAG,CAAC,MAA6C,EAAE,KAAqB,EAAQ,EAAE;IAChH,MAAM,MAAM,GAAG,IAAA,uBAAe,EAAC,MAAM,EAAE,KAAK,CAAC,IAAI,EAAE,qBAAI,CAAC,IAAI,EAAE,KAAK,CAAC,SAAS,CAAC,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;IACnH,MAAM,MAAM,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC9B,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,IAAA,+BAAuB,EACjD,KAAK,CAAC,IAAI,EACV,CAAC,EACD,CAAC,EACD,KAAK,CAAC,SAAS,CAAC,QAAQ,EACxB,KAAK,CAAC,WAAW,CACjB,CAAC;IACF,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,EAAE,CAAC,EAAE,EAAE;QAChC,IAAA,mBAAW,EAAC,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;QAC5F,IAAA,mBAAW,EAAC,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;KAC5F;AACF,CAAC,CAAC;AAEW,QAAA,YAAY,GAAoB;IAC5C,OAAO,EAAE,YAA+B;IACxC,eAAe,EAAE,CAAC,YAAoB,EAAE,KAAqB,EAAE,EAAE;;QAChE,MAAM,MAAM,GAAG,MAAA,KAAK,CAAC,MAAM,mCAAI,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC;QAC1F,IAAI,MAAM,EAAE;YACX,yBAAyB,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;SACzC;IACF,CAAC;CACD,CAAC","sourcesContent":["import { Race } from '@firestone-hs/reference-data';\r\nimport { CardIds } from '../../../services/card-ids';\r\nimport { modifyStats } from '../../../simulation/stats';\r\nimport { hasCorrectTribe, withTavernSpellStatBuff } from '../../../utils';\r\nimport { CastSpellInput, TavernSpellCard } from '../../card.interface';\r\n\r\n/** Give a minion +2/+2 twice. If it's a Naga, repeat this (two more +2/+2 applications). */\r\nconst applyShiftingTideToTarget = (target: NonNullable<CastSpellInput['target']>, input: CastSpellInput): void => {\r\n\tconst isNaga = hasCorrectTribe(target, input.hero, Race.NAGA, input.gameState.anomalies, input.gameState.allCards);\r\n\tconst rounds = isNaga ? 2 : 1;\r\n\tconst { attack, health } = withTavernSpellStatBuff(\r\n\t\tinput.hero,\r\n\t\t1,\r\n\t\t1,\r\n\t\tinput.gameState.allCards,\r\n\t\tinput.spellCardId,\r\n\t);\r\n\tfor (let r = 0; r < rounds; r++) {\r\n\t\tmodifyStats(target, input.source, attack, health, input.board, input.hero, input.gameState);\r\n\t\tmodifyStats(target, input.source, attack, health, input.board, input.hero, input.gameState);\r\n\t}\r\n};\r\n\r\nexport const ShiftingTide: TavernSpellCard = {\r\n\tcardIds: [CardIds.ShiftingTide_BG32_815],\r\n\tcastTavernSpell: (_spellCardId: string, input: CastSpellInput) => {\r\n\t\tconst target = input.target ?? input.board.find((e) => e.health > 0 && !e.definitelyDead);\r\n\t\tif (target) {\r\n\t\t\tapplyShiftingTideToTarget(target, input);\r\n\t\t}\r\n\t},\r\n};\r\n"]}
1
+ {"version":3,"file":"shifting-tide.js","sourceRoot":"","sources":["../../../../src/cards/impl/bg-spell/shifting-tide.ts"],"names":[],"mappings":";;;AAAA,iEAAoD;AAEpD,qDAAwD;AACxD,0CAA0E;AAI1E,MAAM,yBAAyB,GAAG,CAAC,MAA6C,EAAE,KAAqB,EAAQ,EAAE;IAChH,MAAM,MAAM,GAAG,IAAA,uBAAe,EAAC,MAAM,EAAE,KAAK,CAAC,IAAI,EAAE,qBAAI,CAAC,IAAI,EAAE,KAAK,CAAC,SAAS,CAAC,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;IACnH,MAAM,MAAM,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC9B,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,IAAA,+BAAuB,EAAC,KAAK,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,QAAQ,EAAE,KAAK,CAAC,WAAW,CAAC,CAAC;IAClH,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,EAAE,CAAC,EAAE,EAAE;QAChC,IAAA,mBAAW,EAAC,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;QAC5F,IAAA,mBAAW,EAAC,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;KAC5F;AACF,CAAC,CAAC;AAEW,QAAA,YAAY,GAAoB;IAC5C,OAAO,EAAE,YAA+B;IACxC,eAAe,EAAE,CAAC,YAAoB,EAAE,KAAqB,EAAE,EAAE;;QAChE,MAAM,MAAM,GAAG,MAAA,KAAK,CAAC,MAAM,mCAAI,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC;QAC1F,IAAI,MAAM,EAAE;YACX,yBAAyB,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;SACzC;IACF,CAAC;CACD,CAAC","sourcesContent":["import { Race } from '@firestone-hs/reference-data';\r\nimport { CardIds } from '../../../services/card-ids';\r\nimport { modifyStats } from '../../../simulation/stats';\r\nimport { hasCorrectTribe, withTavernSpellStatBuff } from '../../../utils';\r\nimport { CastSpellInput, TavernSpellCard } from '../../card.interface';\r\n\r\n/** Give a minion +2/+2 twice. If it's a Naga, repeat this (two more +2/+2 applications). */\r\nconst applyShiftingTideToTarget = (target: NonNullable<CastSpellInput['target']>, input: CastSpellInput): void => {\r\n\tconst isNaga = hasCorrectTribe(target, input.hero, Race.NAGA, input.gameState.anomalies, input.gameState.allCards);\r\n\tconst rounds = isNaga ? 2 : 1;\r\n\tconst { attack, health } = withTavernSpellStatBuff(input.hero, 1, 1, input.gameState.allCards, input.spellCardId);\r\n\tfor (let r = 0; r < rounds; r++) {\r\n\t\tmodifyStats(target, input.source, attack, health, input.board, input.hero, input.gameState);\r\n\t\tmodifyStats(target, input.source, attack, health, input.board, input.hero, input.gameState);\r\n\t}\r\n};\r\n\r\nexport const ShiftingTide: TavernSpellCard = {\r\n\tcardIds: [CardIds.ShiftingTide_BG32_815],\r\n\tcastTavernSpell: (_spellCardId: string, input: CastSpellInput) => {\r\n\t\tconst target = input.target ?? input.board.find((e) => e.health > 0 && !e.definitelyDead);\r\n\t\tif (target) {\r\n\t\t\tapplyShiftingTideToTarget(target, input);\r\n\t\t}\r\n\t},\r\n};\r\n"]}
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.AbyssalBruiser = void 0;
4
4
  const divine_shield_1 = require("../../../keywords/divine-shield");
5
+ const stats_1 = require("../../../simulation/stats");
5
6
  exports.AbyssalBruiser = {
6
7
  cardIds: ["BG35_921", "BG35_921_G"],
7
8
  onSpawned: (minion, input) => {
@@ -39,10 +40,7 @@ exports.AbyssalBruiser = {
39
40
  return;
40
41
  }
41
42
  const mult = entity.cardId === "BG35_921_G" ? 2 : 1;
42
- entity.attack += mult;
43
- entity.attack = Math.max(entity.attack, entity.maxAttack);
44
- entity.health += mult;
45
- entity.maxHealth = Math.max(entity.maxHealth, entity.health);
43
+ (0, stats_1.modifyStats)(entity, entity, mult, mult, input.board, input.hero, input.gameState);
46
44
  },
47
45
  };
48
46
  //# sourceMappingURL=abyssal-bruiser.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"abyssal-bruiser.js","sourceRoot":"","sources":["../../../../src/cards/impl/minion/abyssal-bruiser.ts"],"names":[],"mappings":";;;AACA,mEAAqE;AAKxD,QAAA,cAAc,GAA4D;IACtF,OAAO,EAAE,0BAAoE;IAC7E,SAAS,EAAE,CAAC,MAAmB,EAAE,KAAmB,EAAE,EAAE;;QACvD,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,iBAAsC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACzE,MAAM,CAAC,GAAG,MAAA,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,wBAAwB,mCAAI,CAAC,CAAC;QAC9D,IAAI,KAAK,CAAC,gBAAgB,EAAE;YAC3B,MAAM,CAAC,MAAM,IAAI,CAAC,GAAG,IAAI,CAAC;YAC1B,MAAM,CAAC,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC;SACjC;QACD,IAAI,KAAK,CAAC,gBAAgB,EAAE;YAC3B,MAAM,CAAC,MAAM,IAAI,CAAC,GAAG,IAAI,CAAC;YAC1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S,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;SAC7D;IACF,CAAC;IACD,iBAAiB,EAAE,CAAC,MAAmB,EAAE,KAAqB,EAAE,EAAE;QACjE,IAAI,KAAK,CAAC,MAAM,KAAK,KAAK,CAAC,IAAI,EAAE;YAChC,OAAO;SACP;QAED,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,iBAAsC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACzE,MAAM,CAAC,MAAM,IAAI,IAAI,CAAC;QACtB,MAAM,CAAC,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,SAAS,CAAC,CAAC;QAC1D,MAAM,CAAC,MAAM,IAAI,IAAI,CAAC;QACtB,MAAM,CAAC,SAAS,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;IAC9D,CAAC;CACD,CAAC","sourcesContent":["import { BoardEntity } from '../../../board-entity';\r\nimport { updateDivineShield } from '../../../keywords/divine-shield';\r\nimport { CardIds } from '../../../services/card-ids';\r\nimport { OnDespawnInput, OnSpawnInput } from '../../../simulation/add-minion-to-board';\r\nimport { CastSpellInput, OnDespawnedCard, OnSpawnedCard, OnTavernSpellCastCard } from '../../card.interface';\r\n\r\nexport const AbyssalBruiser: OnDespawnedCard & OnSpawnedCard & OnTavernSpellCastCard = {\r\n\tcardIds: [CardIds.AbyssalBruiser_BG35_921, CardIds.AbyssalBruiser_BG35_921_G],\r\n\tonSpawned: (minion: BoardEntity, input: OnSpawnInput) => {\r\n\t\tconst mult = minion.cardId === CardIds.AbyssalBruiser_BG35_921_G ? 2 : 1;\r\n\t\tconst n = input.hero.globalInfo.TavernSpellsCastThisGame ?? 0;\r\n\t\tif (input.applyAttackAuras) {\r\n\t\t\tminion.attack += n * mult;\r\n\t\t\tminion.maxAttack = minion.attack;\r\n\t\t}\r\n\t\tif (input.applyHealthAuras) {\r\n\t\t\tminion.health += n * mult;\r\n\t\t\tminion.maxHealth = Math.max(minion.maxHealth, minion.health);\r\n\t\t}\r\n\t\tconst otherHero =\r\n\t\t\tinput.gameState.gameState.player.player === input.hero\r\n\t\t\t\t? input.gameState.gameState.opponent.player\r\n\t\t\t\t: input.gameState.gameState.player.player;\r\n\t\tupdateDivineShield(minion, input.board, input.hero, otherHero, true, input.gameState);\r\n\t},\r\n\tonDespawned: (minion: BoardEntity, input: OnDespawnInput) => {\r\n\t\tconst mult = minion.cardId === CardIds.AbyssalBruiser_BG35_921_G ? 2 : 1;\r\n\t\tconst n = input.hero.globalInfo.TavernSpellsCastThisGame ?? 0;\r\n\t\tif (input.applyAttackAuras) {\r\n\t\t\tminion.attack = Math.max(0, minion.attack - n * mult);\r\n\t\t\tminion.maxAttack = Math.max(minion.maxAttack, minion.attack);\r\n\t\t}\r\n\t\tif (input.applyHealthAuras) {\r\n\t\t\tminion.health = Math.max(1, minion.health - n * mult);\r\n\t\t\tminion.maxHealth = Math.max(minion.maxHealth, minion.health);\r\n\t\t}\r\n\t},\r\n\tonTavernSpellCast: (entity: BoardEntity, input: CastSpellInput) => {\r\n\t\tif (input.source !== input.hero) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tconst mult = entity.cardId === CardIds.AbyssalBruiser_BG35_921_G ? 2 : 1;\r\n\t\tentity.attack += mult;\r\n\t\tentity.attack = Math.max(entity.attack, entity.maxAttack);\r\n\t\tentity.health += mult;\r\n\t\tentity.maxHealth = Math.max(entity.maxHealth, entity.health);\r\n\t},\r\n};\r\n"]}
1
+ {"version":3,"file":"abyssal-bruiser.js","sourceRoot":"","sources":["../../../../src/cards/impl/minion/abyssal-bruiser.ts"],"names":[],"mappings":";;;AACA,mEAAqE;AAGrE,qDAAwD;AAG3C,QAAA,cAAc,GAA4D;IACtF,OAAO,EAAE,0BAAoE;IAC7E,S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CAAC,UAAU,CAAC,wBAAwB,mCAAI,CAAC,CAAC;QAC9D,IAAI,KAAK,CAAC,gBAAgB,EAAE;YAC3B,MAAM,CAAC,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,MAAM,CAAC,MAAM,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC;YACtD,MAAM,CAAC,SAAS,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;SAC7D;QACD,IAAI,KAAK,CAAC,gBAAgB,EAAE;YAC3B,MAAM,CAAC,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,MAAM,CAAC,MAAM,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC;YACtD,MAAM,CAAC,SAAS,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;SAC7D;IACF,CAAC;IACD,iBAAiB,EAAE,CAAC,MAAmB,EAAE,KAAqB,EAAE,EAAE;QACjE,IAAI,KAAK,CAAC,MAAM,KAAK,KAAK,CAAC,IAAI,EAAE;YAChC,OAAO;SACP;QAED,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,iBAAsC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACzE,IAAA,mBAAW,EAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;IACnF,CAAC;CACD,CAAC","sourcesContent":["import { BoardEntity } from '../../../board-entity';\r\nimport { updateDivineShield } from '../../../keywords/divine-shield';\r\nimport { CardIds } from '../../../services/card-ids';\r\nimport { OnDespawnInput, OnSpawnInput } from '../../../simulation/add-minion-to-board';\r\nimport { modifyStats } from '../../../simulation/stats';\r\nimport { CastSpellInput, OnDespawnedCard, OnSpawnedCard, OnTavernSpellCastCard } from '../../card.interface';\r\n\r\nexport const AbyssalBruiser: OnDespawnedCard & OnSpawnedCard & OnTavernSpellCastCard = {\r\n\tcardIds: [CardIds.AbyssalBruiser_BG35_921, CardIds.AbyssalBruiser_BG35_921_G],\r\n\tonSpawned: (minion: BoardEntity, input: OnSpawnInput) => {\r\n\t\tconst mult = minion.cardId === CardIds.AbyssalBruiser_BG35_921_G ? 2 : 1;\r\n\t\tconst n = input.hero.globalInfo.TavernSpellsCastThisGame ?? 0;\r\n\t\tif (input.applyAttackAuras) {\r\n\t\t\tminion.attack += n * mult;\r\n\t\t\tminion.maxAttack = minion.attack;\r\n\t\t}\r\n\t\tif (input.applyHealthAuras) {\r\n\t\t\tminion.health += n * mult;\r\n\t\t\tminion.maxHealth = Math.max(minion.maxHealth, minion.health);\r\n\t\t}\r\n\t\tconst otherHero =\r\n\t\t\tinput.gameState.gameState.player.player === input.hero\r\n\t\t\t\t? input.gameState.gameState.opponent.player\r\n\t\t\t\t: input.gameState.gameState.player.player;\r\n\t\tupdateDivineShield(minion, input.board, input.hero, otherHero, true, input.gameState);\r\n\t},\r\n\tonDespawned: (minion: BoardEntity, input: OnDespawnInput) => {\r\n\t\tconst mult = minion.cardId === CardIds.AbyssalBruiser_BG35_921_G ? 2 : 1;\r\n\t\tconst n = input.hero.globalInfo.TavernSpellsCastThisGame ?? 0;\r\n\t\tif (input.applyAttackAuras) {\r\n\t\t\tminion.attack = Math.max(0, minion.attack - n * mult);\r\n\t\t\tminion.maxAttack = Math.max(minion.maxAttack, minion.attack);\r\n\t\t}\r\n\t\tif (input.applyHealthAuras) {\r\n\t\t\tminion.health = Math.max(1, minion.health - n * mult);\r\n\t\t\tminion.maxHealth = Math.max(minion.maxHealth, minion.health);\r\n\t\t}\r\n\t},\r\n\tonTavernSpellCast: (entity: BoardEntity, input: CastSpellInput) => {\r\n\t\tif (input.source !== input.hero) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tconst mult = entity.cardId === CardIds.AbyssalBruiser_BG35_921_G ? 2 : 1;\r\n\t\tmodifyStats(entity, entity, mult, mult, input.board, input.hero, input.gameState);\r\n\t},\r\n};\r\n"]}
@@ -15,8 +15,10 @@ exports.ClunkerJunker = {
15
15
  const numberOfMagnetizes = minion.cardId === "BG29_503" ? 1 : 2;
16
16
  for (let i = 0; i < numberOfMagnetizes; i++) {
17
17
  const minionToMagnetize = input.gameState.cardsData.getRandomMechToMagnetize((_a = input.hero.tavernTier) !== null && _a !== void 0 ? _a : 1);
18
- input.gameState.spectator.registerPowerTarget(minion, junkerTarget, input.board, null, null);
19
- (0, magnetize_1.magnetizeToTarget)([junkerTarget], minion, [minionToMagnetize], input.board, input.hero, input.otherBoard, input.otherHero, input.gameState);
18
+ if (minionToMagnetize) {
19
+ input.gameState.spectator.registerPowerTarget(minion, junkerTarget, input.board, null, null);
20
+ (0, magnetize_1.magnetizeToTarget)([junkerTarget], minion, [minionToMagnetize], input.board, input.hero, input.otherBoard, input.otherHero, input.gameState);
21
+ }
20
22
  }
21
23
  }
22
24
  return true;
@@ -1 +1 @@
1
- {"version":3,"file":"clunker-junker.js","sourceRoot":"","sources":["../../../../src/cards/impl/minion/clunker-junker.ts"],"names":[],"mappings":";;;AAAA,iEAAoD;AAGpD,mDAAqD;AAErD,6DAAkE;AAClE,0CAAiD;AAGpC,QAAA,aAAa,GAAkB;IAC3C,OAAO,EAAE,0BAAkE;IAC3E,SAAS,EAAE,CAAC,MAAmB,EAAE,KAAqB,EAAE,EAAE;;QACzD,MAAM,cAAc,GAAG,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAC/C,IAAA,uBAAe,EAAC,CAAC,EAAE,KAAK,CAAC,IAAI,EAAE,qBAAI,CAAC,IAAI,EAAE,KAAK,CAAC,SAAS,CAAC,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC,QAAQ,CAAC,CAC9F,CAAC;QACF,MAAM,YAAY,GAAG,IAAA,kBAAU,EAAC,cAAc,CAAC,CAAC;QAChD,IAAI,YAAY,EAAE;YACjB,MAAM,kBAAkB,GAAG,MAAM,CAAC,MAAM,eAAmC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YACpF,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,kBAAkB,EAAE,CAAC,EAAE,EAAE;gBAC5C,MAAM,iBAAiB,GAAG,KAAK,CAAC,SAAS,CAAC,SAAS,CAAC,wBAAwB,CAC3E,MAAA,KAAK,CAAC,IAAI,CAAC,UAAU,mCAAI,CAAC,CAC1B,CAAC;gBACF,KAAK,CAAC,SAAS,CAAC,SAAS,CAAC,mBAAmB,CAAC,MAAM,EAAE,YAAY,EAAE,KAAK,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;gBAC7F,IAAA,6BAAiB,EAChB,CAAC,YAAY,CAAC,EACd,MAAM,EACN,CAAC,iBAAiB,CAAC,EACnB,KAAK,CAAC,KAAK,EACX,KAAK,CAAC,IAAI,EACV,KAAK,CAAC,UAAU,EAChB,KAAK,CAAC,SAAS,EACf,KAAK,CAAC,SAAS,CACf,CAAC;aACF;SACD;QACD,OAAO,IAAI,CAAC;IACb,CAAC;CACD,CAAC","sourcesContent":["import { Race } from '@firestone-hs/reference-data';\r\nimport { BoardEntity } from '../../../board-entity';\r\nimport { CardIds } from '../../../services/card-ids';\r\nimport { pickRandom } from '../../../services/utils';\r\nimport { BattlecryInput } from '../../../simulation/battlecries';\r\nimport { magnetizeToTarget } from '../../../simulation/magnetize';\r\nimport { hasCorrectTribe } from '../../../utils';\r\nimport { BattlecryCard } from '../../card.interface';\r\n\r\nexport const ClunkerJunker: BattlecryCard = {\r\n\tcardIds: [CardIds.ClunkerJunker_BG29_503, CardIds.ClunkerJunker_BG29_503_G],\r\n\tbattlecry: (minion: BoardEntity, input: BattlecryInput) => {\r\n\t\tconst boardWithMechs = input.board.filter((e) =>\r\n\t\t\thasCorrectTribe(e, input.hero, Race.MECH, input.gameState.anomalies, input.gameState.allCards),\r\n\t\t);\r\n\t\tconst junkerTarget = pickRandom(boardWithMechs);\r\n\t\tif (junkerTarget) {\r\n\t\t\tconst numberOfMagnetizes = minion.cardId === CardIds.ClunkerJunker_BG29_503 ? 1 : 2;\r\n\t\t\tfor (let i = 0; i < numberOfMagnetizes; i++) {\r\n\t\t\t\tconst minionToMagnetize = input.gameState.cardsData.getRandomMechToMagnetize(\r\n\t\t\t\t\tinput.hero.tavernTier ?? 1,\r\n\t\t\t\t);\r\n\t\t\t\tinput.gameState.spectator.registerPowerTarget(minion, junkerTarget, input.board, null, null);\r\n\t\t\t\tmagnetizeToTarget(\r\n\t\t\t\t\t[junkerTarget],\r\n\t\t\t\t\tminion,\r\n\t\t\t\t\t[minionToMagnetize],\r\n\t\t\t\t\tinput.board,\r\n\t\t\t\t\tinput.hero,\r\n\t\t\t\t\tinput.otherBoard,\r\n\t\t\t\t\tinput.otherHero,\r\n\t\t\t\t\tinput.gameState,\r\n\t\t\t\t);\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn true;\r\n\t},\r\n};\r\n"]}
1
+ {"version":3,"file":"clunker-junker.js","sourceRoot":"","sources":["../../../../src/cards/impl/minion/clunker-junker.ts"],"names":[],"mappings":";;;AAAA,iEAAoD;AAGpD,mDAAqD;AAErD,6DAAkE;AAClE,0CAAiD;AAGpC,QAAA,aAAa,GAAkB;IAC3C,OAAO,EAAE,0BAAkE;IAC3E,SAAS,EAAE,CAAC,MAAmB,EAAE,KAAqB,EAAE,EAAE;;QACzD,MAAM,cAAc,GAAG,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAC/C,IAAA,uBAAe,EAAC,CAAC,EAAE,KAAK,CAAC,IAAI,EAAE,qBAAI,CAAC,IAAI,EAAE,KAAK,CAAC,SAAS,CAAC,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC,QAAQ,CAAC,CAC9F,CAAC;QACF,MAAM,YAAY,GAAG,IAAA,kBAAU,EAAC,cAAc,CAAC,CAAC;QAChD,IAAI,YAAY,EAAE;YACjB,MAAM,kBAAkB,GAAG,MAAM,CAAC,MAAM,eAAmC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YACpF,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,kBAAkB,EAAE,CAAC,EAAE,EAAE;gBAC5C,MAAM,iBAAiB,GAAG,KAAK,CAAC,SAAS,CAAC,SAAS,CAAC,wBAAwB,CAC3E,MAAA,KAAK,CAAC,IAAI,CAAC,UAAU,mCAAI,CAAC,CAC1B,CAAC;gBACF,IAAI,iBAAiB,EAAE;oBACtB,KAAK,CAAC,SAAS,CAAC,SAAS,CAAC,mBAAmB,CAAC,MAAM,EAAE,YAAY,EAAE,KAAK,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;oBAC7F,IAAA,6BAAiB,EAChB,CAAC,YAAY,CAAC,EACd,MAAM,EACN,CAAC,iBAAiB,CAAC,EACnB,KAAK,CAAC,KAAK,EACX,KAAK,CAAC,IAAI,EACV,KAAK,CAAC,UAAU,EAChB,KAAK,CAAC,SAAS,EACf,KAAK,CAAC,SAAS,CACf,CAAC;iBACF;aACD;SACD;QACD,OAAO,IAAI,CAAC;IACb,CAAC;CACD,CAAC","sourcesContent":["import { Race } from '@firestone-hs/reference-data';\r\nimport { BoardEntity } from '../../../board-entity';\r\nimport { CardIds } from '../../../services/card-ids';\r\nimport { pickRandom } from '../../../services/utils';\r\nimport { BattlecryInput } from '../../../simulation/battlecries';\r\nimport { magnetizeToTarget } from '../../../simulation/magnetize';\r\nimport { hasCorrectTribe } from '../../../utils';\r\nimport { BattlecryCard } from '../../card.interface';\r\n\r\nexport const ClunkerJunker: BattlecryCard = {\r\n\tcardIds: [CardIds.ClunkerJunker_BG29_503, CardIds.ClunkerJunker_BG29_503_G],\r\n\tbattlecry: (minion: BoardEntity, input: BattlecryInput) => {\r\n\t\tconst boardWithMechs = input.board.filter((e) =>\r\n\t\t\thasCorrectTribe(e, input.hero, Race.MECH, input.gameState.anomalies, input.gameState.allCards),\r\n\t\t);\r\n\t\tconst junkerTarget = pickRandom(boardWithMechs);\r\n\t\tif (junkerTarget) {\r\n\t\t\tconst numberOfMagnetizes = minion.cardId === CardIds.ClunkerJunker_BG29_503 ? 1 : 2;\r\n\t\t\tfor (let i = 0; i < numberOfMagnetizes; i++) {\r\n\t\t\t\tconst minionToMagnetize = input.gameState.cardsData.getRandomMechToMagnetize(\r\n\t\t\t\t\tinput.hero.tavernTier ?? 1,\r\n\t\t\t\t);\r\n\t\t\t\tif (minionToMagnetize) {\r\n\t\t\t\t\tinput.gameState.spectator.registerPowerTarget(minion, junkerTarget, input.board, null, null);\r\n\t\t\t\t\tmagnetizeToTarget(\r\n\t\t\t\t\t\t[junkerTarget],\r\n\t\t\t\t\t\tminion,\r\n\t\t\t\t\t\t[minionToMagnetize],\r\n\t\t\t\t\t\tinput.board,\r\n\t\t\t\t\t\tinput.hero,\r\n\t\t\t\t\t\tinput.otherBoard,\r\n\t\t\t\t\t\tinput.otherHero,\r\n\t\t\t\t\t\tinput.gameState,\r\n\t\t\t\t\t);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn true;\r\n\t},\r\n};\r\n"]}
@@ -14,7 +14,7 @@ exports.Mummifier = {
14
14
  .filter((e) => e.cardId !== "BG28_309" && e.cardId !== "BG28_309_G")
15
15
  .filter((e) => !e.reborn)
16
16
  .filter((e) => (0, utils_2.hasCorrectTribe)(e, input.boardWithDeadEntityHero, reference_data_1.Race.UNDEAD, input.gameState.anomalies, input.gameState.allCards));
17
- const target = (0, utils_1.pickRandom)(targets);
17
+ const target = (0, utils_1.pickRandom)(targets, minion);
18
18
  if (target) {
19
19
  (0, reborn_1.updateReborn)(target, true, input.boardWithDeadEntity, input.boardWithDeadEntityHero, input.otherBoardHero, input.gameState);
20
20
  input.gameState.spectator.registerPowerTarget(minion, target, input.boardWithDeadEntity, input.boardWithDeadEntityHero, input.otherBoardHero);
@@ -1 +1 @@
1
- {"version":3,"file":"mummifier.js","sourceRoot":"","sources":["../../../../src/cards/impl/minion/mummifier.ts"],"names":[],"mappings":";;;AACA,iEAAoD;AAEpD,qDAAwD;AACxD,mDAAqD;AAErD,0CAAiD;AAGpC,QAAA,SAAS,GAAyB;IAC9C,OAAO,EAAE,0BAA0D;IACnE,gBAAgB,EAAE,CAAC,MAAmB,EAAE,KAAgC,EAAE,EAAE;QAC3E,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,iBAAiC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAC7E,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,aAAa,EAAE,CAAC,EAAE,EAAE;YACvC,MAAM,OAAO,GAAG,KAAK,CAAC,mBAAmB;iBACvC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,eAA+B,IAAI,CAAC,CAAC,MAAM,iBAAiC,CAAC;iBACnG,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;iBACxB,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CACb,IAAA,uBAAe,EACd,CAAC,EACD,KAAK,CAAC,uBAAuB,EAC7B,qBAAI,CAAC,MAAM,EACX,KAAK,CAAC,SAAS,CAAC,SAAS,EACzB,KAAK,CAAC,SAAS,CAAC,QAAQ,CACxB,CACD,CAAC;YACH,MAAM,MAAM,GAAG,IAAA,kBAAU,EAAC,OAAO,CAAC,CAAC;YACnC,IAAI,MAAM,EAAE;gBACX,IAAA,qBAAY,EACX,MAAM,EACN,IAAI,EACJ,KAAK,CAAC,mBAAmB,EACzB,KAAK,CAAC,uBAAuB,EAC7B,KAAK,CAAC,cAAc,EACpB,KAAK,CAAC,SAAS,CACf,CAAC;gBACF,KAAK,CAAC,SAAS,CAAC,SAAS,CAAC,mBAAmB,CAC5C,MAAM,EACN,MAAM,EACN,KAAK,CAAC,mBAAmB,EACzB,KAAK,CAAC,uBAAuB,EAC7B,KAAK,CAAC,cAAc,CACpB,CAAC;aACF;SACD;QACD,OAAO,EAAE,CAAC;IACX,CAAC;CACD,CAAC","sourcesContent":["import { CardIds } from '../../../services/card-ids';\nimport { Race } from '@firestone-hs/reference-data';\nimport { BoardEntity } from '../../../board-entity';\r\nimport { updateReborn } from '../../../keywords/reborn';\r\nimport { pickRandom } from '../../../services/utils';\r\nimport { DeathrattleTriggeredInput } from '../../../simulation/deathrattle-on-trigger';\r\nimport { hasCorrectTribe } from '../../../utils';\r\nimport { DeathrattleSpawnCard } from '../../card.interface';\r\n\r\nexport const Mummifier: DeathrattleSpawnCard = {\r\n\tcardIds: [CardIds.Mummifier_BG28_309, CardIds.Mummifier_BG28_309_G],\r\n\tdeathrattleSpawn: (minion: BoardEntity, input: DeathrattleTriggeredInput) => {\r\n\t\tconst mummifierBuff = minion.cardId === CardIds.Mummifier_BG28_309_G ? 2 : 1;\r\n\t\tfor (let j = 0; j < mummifierBuff; j++) {\r\n\t\t\tconst targets = input.boardWithDeadEntity\r\n\t\t\t\t.filter((e) => e.cardId !== CardIds.Mummifier_BG28_309 && e.cardId !== CardIds.Mummifier_BG28_309_G)\r\n\t\t\t\t.filter((e) => !e.reborn)\r\n\t\t\t\t.filter((e) =>\r\n\t\t\t\t\thasCorrectTribe(\r\n\t\t\t\t\t\te,\r\n\t\t\t\t\t\tinput.boardWithDeadEntityHero,\r\n\t\t\t\t\t\tRace.UNDEAD,\r\n\t\t\t\t\t\tinput.gameState.anomalies,\r\n\t\t\t\t\t\tinput.gameState.allCards,\r\n\t\t\t\t\t),\r\n\t\t\t\t);\r\n\t\t\tconst target = pickRandom(targets);\r\n\t\t\tif (target) {\r\n\t\t\t\tupdateReborn(\r\n\t\t\t\t\ttarget,\r\n\t\t\t\t\ttrue,\r\n\t\t\t\t\tinput.boardWithDeadEntity,\r\n\t\t\t\t\tinput.boardWithDeadEntityHero,\r\n\t\t\t\t\tinput.otherBoardHero,\r\n\t\t\t\t\tinput.gameState,\r\n\t\t\t\t);\r\n\t\t\t\tinput.gameState.spectator.registerPowerTarget(\r\n\t\t\t\t\tminion,\r\n\t\t\t\t\ttarget,\r\n\t\t\t\t\tinput.boardWithDeadEntity,\r\n\t\t\t\t\tinput.boardWithDeadEntityHero,\r\n\t\t\t\t\tinput.otherBoardHero,\r\n\t\t\t\t);\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn [];\r\n\t},\r\n};\r\n"]}
1
+ {"version":3,"file":"mummifier.js","sourceRoot":"","sources":["../../../../src/cards/impl/minion/mummifier.ts"],"names":[],"mappings":";;;AAAA,iEAAoD;AAEpD,qDAAwD;AAExD,mDAAqD;AAErD,0CAAiD;AAGpC,QAAA,SAAS,GAAyB;IAC9C,OAAO,EAAE,0BAA0D;IACnE,gBAAgB,EAAE,CAAC,MAAmB,EAAE,KAAgC,EAAE,EAAE;QAC3E,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,iBAAiC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAC7E,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,aAAa,EAAE,CAAC,EAAE,EAAE;YACvC,MAAM,OAAO,GAAG,KAAK,CAAC,mBAAmB;iBACvC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,eAA+B,IAAI,CAAC,CAAC,MAAM,iBAAiC,CAAC;iBACnG,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;iBACxB,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CACb,IAAA,uBAAe,EACd,CAAC,EACD,KAAK,CAAC,uBAAuB,EAC7B,qBAAI,CAAC,MAAM,EACX,KAAK,CAAC,SAAS,CAAC,SAAS,EACzB,KAAK,CAAC,SAAS,CAAC,QAAQ,CACxB,CACD,CAAC;YACH,MAAM,MAAM,GAAG,IAAA,kBAAU,EAAC,OAAO,EAAE,MAAM,CAAC,CAAC;YAC3C,IAAI,MAAM,EAAE;gBACX,IAAA,qBAAY,EACX,MAAM,EACN,IAAI,EACJ,KAAK,CAAC,mBAAmB,EACzB,KAAK,CAAC,uBAAuB,EAC7B,KAAK,CAAC,cAAc,EACpB,KAAK,CAAC,SAAS,CACf,CAAC;gBACF,KAAK,CAAC,SAAS,CAAC,SAAS,CAAC,mBAAmB,CAC5C,MAAM,EACN,MAAM,EACN,KAAK,CAAC,mBAAmB,EACzB,KAAK,CAAC,uBAAuB,EAC7B,KAAK,CAAC,cAAc,CACpB,CAAC;aACF;SACD;QACD,OAAO,EAAE,CAAC;IACX,CAAC;CACD,CAAC","sourcesContent":["import { Race } from '@firestone-hs/reference-data';\r\nimport { BoardEntity } from '../../../board-entity';\r\nimport { updateReborn } from '../../../keywords/reborn';\r\nimport { CardIds } from '../../../services/card-ids';\r\nimport { pickRandom } from '../../../services/utils';\r\nimport { DeathrattleTriggeredInput } from '../../../simulation/deathrattle-on-trigger';\r\nimport { hasCorrectTribe } from '../../../utils';\r\nimport { DeathrattleSpawnCard } from '../../card.interface';\r\n\r\nexport const Mummifier: DeathrattleSpawnCard = {\r\n\tcardIds: [CardIds.Mummifier_BG28_309, CardIds.Mummifier_BG28_309_G],\r\n\tdeathrattleSpawn: (minion: BoardEntity, input: DeathrattleTriggeredInput) => {\r\n\t\tconst mummifierBuff = minion.cardId === CardIds.Mummifier_BG28_309_G ? 2 : 1;\r\n\t\tfor (let j = 0; j < mummifierBuff; j++) {\r\n\t\t\tconst targets = input.boardWithDeadEntity\r\n\t\t\t\t.filter((e) => e.cardId !== CardIds.Mummifier_BG28_309 && e.cardId !== CardIds.Mummifier_BG28_309_G)\r\n\t\t\t\t.filter((e) => !e.reborn)\r\n\t\t\t\t.filter((e) =>\r\n\t\t\t\t\thasCorrectTribe(\r\n\t\t\t\t\t\te,\r\n\t\t\t\t\t\tinput.boardWithDeadEntityHero,\r\n\t\t\t\t\t\tRace.UNDEAD,\r\n\t\t\t\t\t\tinput.gameState.anomalies,\r\n\t\t\t\t\t\tinput.gameState.allCards,\r\n\t\t\t\t\t),\r\n\t\t\t\t);\r\n\t\t\tconst target = pickRandom(targets, minion);\r\n\t\t\tif (target) {\r\n\t\t\t\tupdateReborn(\r\n\t\t\t\t\ttarget,\r\n\t\t\t\t\ttrue,\r\n\t\t\t\t\tinput.boardWithDeadEntity,\r\n\t\t\t\t\tinput.boardWithDeadEntityHero,\r\n\t\t\t\t\tinput.otherBoardHero,\r\n\t\t\t\t\tinput.gameState,\r\n\t\t\t\t);\r\n\t\t\t\tinput.gameState.spectator.registerPowerTarget(\r\n\t\t\t\t\tminion,\r\n\t\t\t\t\ttarget,\r\n\t\t\t\t\tinput.boardWithDeadEntity,\r\n\t\t\t\t\tinput.boardWithDeadEntityHero,\r\n\t\t\t\t\tinput.otherBoardHero,\r\n\t\t\t\t);\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn [];\r\n\t},\r\n};\r\n"]}
@@ -11,7 +11,7 @@ exports.TideRaiser = {
11
11
  const raw = (0, attack_1.getNeighbours)(input.boardWithDeadEntity, minion, input.deadEntityIndexFromRight)
12
12
  .filter((e) => !!e)
13
13
  .filter((e) => e.health > 0 && !e.definitelyDead);
14
- const targets = golden ? raw : raw.length ? [(0, utils_1.pickRandom)(raw)] : [];
14
+ const targets = golden ? raw : raw.length ? [(0, utils_1.pickRandom)(raw, minion)] : [];
15
15
  for (const t of targets) {
16
16
  (0, cast_tavern_spell_1.castTavernSpell)("BG32_815", {
17
17
  spellCardId: "BG32_815",
@@ -1 +1 @@
1
- {"version":3,"file":"tide-raiser.js","sourceRoot":"","sources":["../../../../src/cards/impl/minion/tide-raiser.ts"],"names":[],"mappings":";;;AACA,4EAAuE;AAEvE,mDAAqD;AACrD,uDAA2D;AAI9C,QAAA,UAAU,GAAyB;IAC/C,OAAO,EAAE,0BAA4D;IACrE,gBAAgB,EAAE,CAAC,MAAmB,EAAE,KAAgC,EAA0B,EAAE;QACnG,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,iBAAkC,CAAC;QAC/D,MAAM,GAAG,GAAG,IAAA,sBAAa,EAAC,KAAK,CAAC,mBAAmB,EAAE,MAAM,EAAE,KAAK,CAAC,wBAAwB,CAAC;aAC1F,MAAM,CAAC,CAAC,CAAC,EAAoB,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;aACpC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC;QACnD,MAAM,OAAO,GAAG,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAA,kBAAU,EAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QACnE,KAAK,MAAM,CAAC,IAAI,OAAO,EAAE;YACxB,IAAA,mCAAe,cAAgC;gBAC9C,WAAW,YAA+B;gBAC1C,MAAM,EAAE,KAAK,CAAC,uBAAuB;gBACrC,MAAM,EAAE,CAAC;gBACT,KAAK,EAAE,KAAK,CAAC,mBAAmB;gBAChC,IAAI,EAAE,KAAK,CAAC,uBAAuB;gBACnC,UAAU,EAAE,KAAK,CAAC,UAAU;gBAC5B,SAAS,EAAE,KAAK,CAAC,cAAc;gBAC/B,SAAS,EAAE,KAAK,CAAC,SAAS;aAC1B,CAAC,CAAC;SACH;QACD,OAAO,EAAE,CAAC;IACX,CAAC;CACD,CAAC","sourcesContent":["import { BoardEntity } from '../../../board-entity';\r\nimport { castTavernSpell } from '../../../mechanics/cast-tavern-spell';\r\nimport { CardIds } from '../../../services/card-ids';\r\nimport { pickRandom } from '../../../services/utils';\r\nimport { getNeighbours } from '../../../simulation/attack';\r\nimport { DeathrattleTriggeredInput } from '../../../simulation/deathrattle-on-trigger';\r\nimport { DeathrattleSpawnCard } from '../../card.interface';\r\n\r\nexport const TideRaiser: DeathrattleSpawnCard = {\r\n\tcardIds: [CardIds.TideRaiser_BG34_920, CardIds.TideRaiser_BG34_920_G],\r\n\tdeathrattleSpawn: (minion: BoardEntity, input: DeathrattleTriggeredInput): readonly BoardEntity[] => {\r\n\t\tconst golden = minion.cardId === CardIds.TideRaiser_BG34_920_G;\r\n\t\tconst raw = getNeighbours(input.boardWithDeadEntity, minion, input.deadEntityIndexFromRight)\r\n\t\t\t.filter((e): e is BoardEntity => !!e)\r\n\t\t\t.filter((e) => e.health > 0 && !e.definitelyDead);\r\n\t\tconst targets = golden ? raw : raw.length ? [pickRandom(raw)] : [];\r\n\t\tfor (const t of targets) {\r\n\t\t\tcastTavernSpell(CardIds.ShiftingTide_BG32_815, {\r\n\t\t\t\tspellCardId: CardIds.ShiftingTide_BG32_815,\r\n\t\t\t\tsource: input.boardWithDeadEntityHero,\r\n\t\t\t\ttarget: t,\r\n\t\t\t\tboard: input.boardWithDeadEntity,\r\n\t\t\t\thero: input.boardWithDeadEntityHero,\r\n\t\t\t\totherBoard: input.otherBoard,\r\n\t\t\t\totherHero: input.otherBoardHero,\r\n\t\t\t\tgameState: input.gameState,\r\n\t\t\t});\r\n\t\t}\r\n\t\treturn [];\r\n\t},\r\n};\r\n"]}
1
+ {"version":3,"file":"tide-raiser.js","sourceRoot":"","sources":["../../../../src/cards/impl/minion/tide-raiser.ts"],"names":[],"mappings":";;;AACA,4EAAuE;AAEvE,mDAAqD;AACrD,uDAA2D;AAI9C,QAAA,UAAU,GAAyB;IAC/C,OAAO,EAAE,0BAA4D;IACrE,gBAAgB,EAAE,CAAC,MAAmB,EAAE,KAAgC,EAA0B,EAAE;QACnG,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,iBAAkC,CAAC;QAC/D,MAAM,GAAG,GAAG,IAAA,sBAAa,EAAC,KAAK,CAAC,mBAAmB,EAAE,MAAM,EAAE,KAAK,CAAC,wBAAwB,CAAC;aAC1F,MAAM,CAAC,CAAC,CAAC,EAAoB,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;aACpC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC;QACnD,MAAM,OAAO,GAAG,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAA,kBAAU,EAAC,GAAG,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QAC3E,KAAK,MAAM,CAAC,IAAI,OAAO,EAAE;YACxB,IAAA,mCAAe,cAAgC;gBAC9C,WAAW,YAA+B;gBAC1C,MAAM,EAAE,KAAK,CAAC,uBAAuB;gBACrC,MAAM,EAAE,CAAC;gBACT,KAAK,EAAE,KAAK,CAAC,mBAAmB;gBAChC,IAAI,EAAE,KAAK,CAAC,uBAAuB;gBACnC,UAAU,EAAE,KAAK,CAAC,UAAU;gBAC5B,SAAS,EAAE,KAAK,CAAC,cAAc;gBAC/B,SAAS,EAAE,KAAK,CAAC,SAAS;aAC1B,CAAC,CAAC;SACH;QACD,OAAO,EAAE,CAAC;IACX,CAAC;CACD,CAAC","sourcesContent":["import { BoardEntity } from '../../../board-entity';\r\nimport { castTavernSpell } from '../../../mechanics/cast-tavern-spell';\r\nimport { CardIds } from '../../../services/card-ids';\r\nimport { pickRandom } from '../../../services/utils';\r\nimport { getNeighbours } from '../../../simulation/attack';\r\nimport { DeathrattleTriggeredInput } from '../../../simulation/deathrattle-on-trigger';\r\nimport { DeathrattleSpawnCard } from '../../card.interface';\r\n\r\nexport const TideRaiser: DeathrattleSpawnCard = {\r\n\tcardIds: [CardIds.TideRaiser_BG34_920, CardIds.TideRaiser_BG34_920_G],\r\n\tdeathrattleSpawn: (minion: BoardEntity, input: DeathrattleTriggeredInput): readonly BoardEntity[] => {\r\n\t\tconst golden = minion.cardId === CardIds.TideRaiser_BG34_920_G;\r\n\t\tconst raw = getNeighbours(input.boardWithDeadEntity, minion, input.deadEntityIndexFromRight)\r\n\t\t\t.filter((e): e is BoardEntity => !!e)\r\n\t\t\t.filter((e) => e.health > 0 && !e.definitelyDead);\r\n\t\tconst targets = golden ? raw : raw.length ? [pickRandom(raw, minion)] : [];\r\n\t\tfor (const t of targets) {\r\n\t\t\tcastTavernSpell(CardIds.ShiftingTide_BG32_815, {\r\n\t\t\t\tspellCardId: CardIds.ShiftingTide_BG32_815,\r\n\t\t\t\tsource: input.boardWithDeadEntityHero,\r\n\t\t\t\ttarget: t,\r\n\t\t\t\tboard: input.boardWithDeadEntity,\r\n\t\t\t\thero: input.boardWithDeadEntityHero,\r\n\t\t\t\totherBoard: input.otherBoard,\r\n\t\t\t\totherHero: input.otherBoardHero,\r\n\t\t\t\tgameState: input.gameState,\r\n\t\t\t});\r\n\t\t}\r\n\t\treturn [];\r\n\t},\r\n};\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"wrathscale-rogue.js","sourceRoot":"","sources":["../../../../src/cards/impl/minion/wrathscale-rogue.ts"],"names":[],"mappings":";;;AAAA,iEAAoD;AAGpD,qDAA6E;AAC7E,0CAAiD;AAGpC,QAAA,eAAe,GAAuB;IAClD,OAAO,EAAE,0BAAsE;IAC/E,cAAc,EAAE,CAAC,MAAmB,EAAE,KAA0B,EAAE,EAAE;QACnE,IACC,KAAK,CAAC,MAAM,KAAK,MAAM;YACvB,IAAA,uBAAe,EAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,IAAI,EAAE,qBAAI,CAAC,IAAI,EAAE,KAAK,CAAC,SAAS,CAAC,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC,QAAQ,CAAC;YACzG,KAAK,CAAC,YAAY,GAAG,CAAC,EACrB;YACD,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,iBAAuC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YAC1E,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC,EAAE,EAAE;gBAG9B,IAAA,mBAAW,EACV,KAAK,CAAC,MAAM,EACZ,MAAM,EACN,KAAK,CAAC,YAAY,EAClB,CAAC,EACD,KAAK,CAAC,KAAK,EACX,KAAK,CAAC,IAAI,EACV,KAAK,CAAC,SAAS,EACf,KAAK,EACL,IAAI,EACJ,KAAK,CACL,CAAC;aACF;SACD;IACF,CAAC;CACD,CAAC","sourcesContent":["import { Race } from '@firestone-hs/reference-data';\r\nimport { BoardEntity } from '../../../board-entity';\r\nimport { CardIds } from '../../../services/card-ids';\r\nimport { modifyStats, OnStatsChangedInput } from '../../../simulation/stats';\r\nimport { hasCorrectTribe } from '../../../utils';\r\nimport { OnStatsChangedCard } from '../../card.interface';\r\n\r\nexport const WrathscaleRogue: OnStatsChangedCard = {\r\n\tcardIds: [CardIds.WrathscaleRogue_BG33_920, CardIds.WrathscaleRogue_BG33_920_G],\r\n\tonStatsChanged: (minion: BoardEntity, input: OnStatsChangedInput) => {\r\n\t\tif (\r\n\t\t\tinput.target !== minion &&\r\n\t\t\thasCorrectTribe(input.target, input.hero, Race.NAGA, input.gameState.anomalies, input.gameState.allCards) &&\r\n\t\t\tinput.healthAmount > 0\r\n\t\t) {\r\n\t\t\tconst mult = minion.cardId === CardIds.WrathscaleRogue_BG33_920_G ? 2 : 1;\r\n\t\t\tfor (let i = 0; i < mult; i++) {\r\n\t\t\t\t// Patch 33.6.2 made it so Wrathscale Rogue does not trigger Sinestra / Whelp Smuggler / Titanic Guardian\r\n\t\t\t\t// For now we simply mark is as not triggering stat gain effects, and will refine this later\r\n\t\t\t\tmodifyStats(\r\n\t\t\t\t\tinput.target,\r\n\t\t\t\t\tminion,\r\n\t\t\t\t\tinput.healthAmount,\r\n\t\t\t\t\t0,\r\n\t\t\t\t\tinput.board,\r\n\t\t\t\t\tinput.hero,\r\n\t\t\t\t\tinput.gameState,\r\n\t\t\t\t\tfalse,\r\n\t\t\t\t\ttrue,\r\n\t\t\t\t\tfalse,\r\n\t\t\t\t);\r\n\t\t\t}\r\n\t\t}\r\n\t},\r\n};\r\n"]}
1
+ {"version":3,"file":"wrathscale-rogue.js","sourceRoot":"","sources":["../../../../src/cards/impl/minion/wrathscale-rogue.ts"],"names":[],"mappings":";;;AAAA,iEAAoD;AAGpD,qDAA6E;AAC7E,0CAAiD;AAGpC,QAAA,eAAe,GAAuB;IAClD,OAAO,EAAE,0BAAsE;IAI/E,cAAc,EAAE,CAAC,MAAmB,EAAE,KAA0B,EAAE,EAAE;QACnE,IACC,KAAK,CAAC,MAAM,KAAK,MAAM;YACvB,IAAA,uBAAe,EAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,IAAI,EAAE,qBAAI,CAAC,IAAI,EAAE,KAAK,CAAC,SAAS,CAAC,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC,QAAQ,CAAC;YACzG,KAAK,CAAC,YAAY,GAAG,CAAC,EACrB;YACD,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,iBAAuC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YAC1E,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC,EAAE,EAAE;gBAG9B,IAAA,mBAAW,EACV,KAAK,CAAC,MAAM,EACZ,MAAM,EACN,KAAK,CAAC,YAAY,EAClB,CAAC,EACD,KAAK,CAAC,KAAK,EACX,KAAK,CAAC,IAAI,EACV,KAAK,CAAC,SAAS,EACf,KAAK,EACL,IAAI,EACJ,KAAK,CACL,CAAC;aACF;SACD;IACF,CAAC;CACD,CAAC","sourcesContent":["import { Race } from '@firestone-hs/reference-data';\r\nimport { BoardEntity } from '../../../board-entity';\r\nimport { CardIds } from '../../../services/card-ids';\r\nimport { modifyStats, OnStatsChangedInput } from '../../../simulation/stats';\r\nimport { hasCorrectTribe } from '../../../utils';\r\nimport { OnStatsChangedCard } from '../../card.interface';\r\n\r\nexport const WrathscaleRogue: OnStatsChangedCard = {\r\n\tcardIds: [CardIds.WrathscaleRogue_BG33_920, CardIds.WrathscaleRogue_BG33_920_G],\r\n\t// This should be \"after stats update\", which should, I think, proc after the attack has resolved\r\n\t// I don't have the infrastructure for this yet, so we'll use onStatsChanged for now\r\n\t// But maybe use a deferred trigger for this?\r\n\tonStatsChanged: (minion: BoardEntity, input: OnStatsChangedInput) => {\r\n\t\tif (\r\n\t\t\tinput.target !== minion &&\r\n\t\t\thasCorrectTribe(input.target, input.hero, Race.NAGA, input.gameState.anomalies, input.gameState.allCards) &&\r\n\t\t\tinput.healthAmount > 0\r\n\t\t) {\r\n\t\t\tconst mult = minion.cardId === CardIds.WrathscaleRogue_BG33_920_G ? 2 : 1;\r\n\t\t\tfor (let i = 0; i < mult; i++) {\r\n\t\t\t\t// Patch 33.6.2 made it so Wrathscale Rogue does not trigger Sinestra / Whelp Smuggler / Titanic Guardian\r\n\t\t\t\t// For now we simply mark is as not triggering stat gain effects, and will refine this later\r\n\t\t\t\tmodifyStats(\r\n\t\t\t\t\tinput.target,\r\n\t\t\t\t\tminion,\r\n\t\t\t\t\tinput.healthAmount,\r\n\t\t\t\t\t0,\r\n\t\t\t\t\tinput.board,\r\n\t\t\t\t\tinput.hero,\r\n\t\t\t\t\tinput.gameState,\r\n\t\t\t\t\tfalse,\r\n\t\t\t\t\ttrue,\r\n\t\t\t\t\tfalse,\r\n\t\t\t\t);\r\n\t\t\t}\r\n\t\t}\r\n\t},\r\n};\r\n"]}
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SoulFermenter = void 0;
4
+ const add_minion_to_board_1 = require("../../../simulation/add-minion-to-board");
4
5
  const deathrattle_spawns_1 = require("../../../simulation/deathrattle-spawns");
5
6
  const utils_1 = require("../../../utils");
6
7
  exports.SoulFermenter = {
@@ -10,7 +11,9 @@ exports.SoulFermenter = {
10
11
  const targets = input.playerBoard.slice(0, 3);
11
12
  trinket.rememberedMinions = [];
12
13
  for (const target of targets) {
13
- trinket.rememberedMinions.push((0, utils_1.copyEntity)(target));
14
+ const copy = (0, utils_1.copyEntity)(target);
15
+ (0, add_minion_to_board_1.removeAurasFromSelf)(copy, input.playerBoard, input.playerEntity, input.gameState);
16
+ trinket.rememberedMinions.push(copy);
14
17
  target.definitelyDead = true;
15
18
  }
16
19
  return true;
@@ -30,6 +33,7 @@ exports.SoulFermenter = {
30
33
  deadEntity: minion,
31
34
  }, trinket, 0, minion);
32
35
  }
36
+ trinket.rememberedMinions = [];
33
37
  },
34
38
  };
35
39
  //# sourceMappingURL=soul-fermenter.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"soul-fermenter.js","sourceRoot":"","sources":["../../../../src/cards/impl/trinket/soul-fermenter.ts"],"names":[],"mappings":";;;AAGA,+EAA+F;AAE/F,0CAA4C;AAG/B,QAAA,aAAa,GAAuD;IAChF,OAAO,EAAE,sBAA0C;IACnD,mBAAmB,EAAE,iBAAiB;IACtC,aAAa,EAAE,CAAC,OAAqB,EAAE,KAAe,EAAE,EAAE;QACzD,MAAM,OAAO,GAAG,KAAK,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QAC9C,OAAO,CAAC,iBAAiB,GAAG,EAAE,CAAC;QAC/B,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE;YAC7B,OAAO,CAAC,iBAAiB,CAAC,IAAI,CAAC,IAAA,kBAAU,EAAC,MAAM,CAAC,CAAC,CAAC;YACnD,MAAM,CAAC,cAAc,GAAG,IAAI,CAAC;SAC7B;QACD,OAAO,IAAI,CAAC;IACb,CAAC;IACD,0BAA0B,EAAE,CAAC,OAAqB,EAAE,KAAsC,EAAE,EAAE;;QAC7F,IAAI,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,IAAI,CAAA,MAAA,OAAO,CAAC,iBAAiB,0CAAE,MAAM,MAAK,CAAC,EAAE;YACtE,OAAO;SACP;QAED,KAAK,MAAM,MAAM,IAAI,OAAO,CAAC,iBAAiB,EAAE;YAC/C,IAAA,0DAAqC,EACpC,MAAM,CAAC,MAAM,EACb,CAAC,EACD;gBACC,mBAAmB,EAAE,KAAK,CAAC,KAAK;gBAChC,uBAAuB,EAAE,KAAK,CAAC,IAAI;gBACnC,UAAU,EAAE,KAAK,CAAC,UAAU;gBAC5B,cAAc,EAAE,KAAK,CAAC,SAAS;gBAC/B,SAAS,EAAE,KAAK,CAAC,SAAS;gBAC1B,UAAU,EAAE,MAAM;aAClB,EACD,OAAO,EACP,CAAC,EACD,MAAM,CACN,CAAC;SACF;IACF,CAAC;CACD,CAAC","sourcesContent":["import { BoardTrinket } from '../../../bgs-player-entity';\r\nimport { CardIds } from '../../../services/card-ids';\r\nimport { OnAfterFriendlyMinionDeathInput } from '../../../simulation/attack';\r\nimport { simplifiedSpawnEntitiesWithAddToBoard } from '../../../simulation/deathrattle-spawns';\r\nimport { SoCInput } from '../../../simulation/start-of-combat/start-of-combat-input';\r\nimport { copyEntity } from '../../../utils';\r\nimport { OnAfterFriendlyMinionDeathCard, StartOfCombatCard } from '../../card.interface';\r\n\r\nexport const SoulFermenter: StartOfCombatCard & OnAfterFriendlyMinionDeathCard = {\r\n\tcardIds: [CardIds.SoulFermenter_BG35_MagicItem_732],\r\n\tstartOfCombatTiming: 'start-of-combat',\r\n\tstartOfCombat: (trinket: BoardTrinket, input: SoCInput) => {\r\n\t\tconst targets = input.playerBoard.slice(0, 3);\r\n\t\ttrinket.rememberedMinions = [];\r\n\t\tfor (const target of targets) {\r\n\t\t\ttrinket.rememberedMinions.push(copyEntity(target));\r\n\t\t\ttarget.definitelyDead = true;\r\n\t\t}\r\n\t\treturn true;\r\n\t},\r\n\tonAfterFriendlyMinionDeath: (trinket: BoardTrinket, input: OnAfterFriendlyMinionDeathInput) => {\r\n\t\tif (input.board.length > 0 || trinket.rememberedMinions?.length === 0) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tfor (const minion of trinket.rememberedMinions) {\r\n\t\t\tsimplifiedSpawnEntitiesWithAddToBoard(\r\n\t\t\t\tminion.cardId,\r\n\t\t\t\t1,\r\n\t\t\t\t{\r\n\t\t\t\t\tboardWithDeadEntity: input.board,\r\n\t\t\t\t\tboardWithDeadEntityHero: input.hero,\r\n\t\t\t\t\totherBoard: input.otherBoard,\r\n\t\t\t\t\totherBoardHero: input.otherHero,\r\n\t\t\t\t\tgameState: input.gameState,\r\n\t\t\t\t\tdeadEntity: minion,\r\n\t\t\t\t},\r\n\t\t\t\ttrinket,\r\n\t\t\t\t0,\r\n\t\t\t\tminion,\r\n\t\t\t);\r\n\t\t}\r\n\t},\r\n};\r\n"]}
1
+ {"version":3,"file":"soul-fermenter.js","sourceRoot":"","sources":["../../../../src/cards/impl/trinket/soul-fermenter.ts"],"names":[],"mappings":";;;AAEA,iFAA8E;AAE9E,+EAA+F;AAE/F,0CAA4C;AAG/B,QAAA,aAAa,GAAuD;IAChF,OAAO,EAAE,sBAA0C;IACnD,mBAAmB,EAAE,iBAAiB;IACtC,aAAa,EAAE,CAAC,OAAqB,EAAE,KAAe,EAAE,EAAE;QACzD,MAAM,OAAO,GAAG,KAAK,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QAC9C,OAAO,CAAC,iBAAiB,GAAG,EAAE,CAAC;QAC/B,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE;YAC7B,MAAM,IAAI,GAAG,IAAA,kBAAU,EAAC,MAAM,CAAC,CAAC;YAChC,IAAA,yCAAmB,EAAC,IAAI,EAAE,KAAK,CAAC,WAAW,EAAE,KAAK,CAAC,YAAY,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;YAClF,OAAO,CAAC,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACrC,MAAM,CAAC,cAAc,GAAG,IAAI,CAAC;SAC7B;QACD,OAAO,IAAI,CAAC;IACb,CAAC;IACD,0BAA0B,EAAE,CAAC,OAAqB,EAAE,KAAsC,EAAE,EAAE;;QAC7F,IAAI,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,IAAI,CAAA,MAAA,OAAO,CAAC,iBAAiB,0CAAE,MAAM,MAAK,CAAC,EAAE;YACtE,OAAO;SACP;QAED,KAAK,MAAM,MAAM,IAAI,OAAO,CAAC,iBAAiB,EAAE;YAC/C,IAAA,0DAAqC,EACpC,MAAM,CAAC,MAAM,EACb,CAAC,EACD;gBACC,mBAAmB,EAAE,KAAK,CAAC,KAAK;gBAChC,uBAAuB,EAAE,KAAK,CAAC,IAAI;gBACnC,UAAU,EAAE,KAAK,CAAC,UAAU;gBAC5B,cAAc,EAAE,KAAK,CAAC,SAAS;gBAC/B,SAAS,EAAE,KAAK,CAAC,SAAS;gBAC1B,UAAU,EAAE,MAAM;aAClB,EACD,OAAO,EACP,CAAC,EACD,MAAM,CACN,CAAC;SACF;QACD,OAAO,CAAC,iBAAiB,GAAG,EAAE,CAAC;IAChC,CAAC;CACD,CAAC","sourcesContent":["import { BoardTrinket } from '../../../bgs-player-entity';\r\nimport { CardIds } from '../../../services/card-ids';\r\nimport { removeAurasFromSelf } from '../../../simulation/add-minion-to-board';\r\nimport { OnAfterFriendlyMinionDeathInput } from '../../../simulation/attack';\r\nimport { simplifiedSpawnEntitiesWithAddToBoard } from '../../../simulation/deathrattle-spawns';\r\nimport { SoCInput } from '../../../simulation/start-of-combat/start-of-combat-input';\r\nimport { copyEntity } from '../../../utils';\r\nimport { OnAfterFriendlyMinionDeathCard, StartOfCombatCard } from '../../card.interface';\r\n\r\nexport const SoulFermenter: StartOfCombatCard & OnAfterFriendlyMinionDeathCard = {\r\n\tcardIds: [CardIds.SoulFermenter_BG35_MagicItem_732],\r\n\tstartOfCombatTiming: 'start-of-combat',\r\n\tstartOfCombat: (trinket: BoardTrinket, input: SoCInput) => {\r\n\t\tconst targets = input.playerBoard.slice(0, 3);\r\n\t\ttrinket.rememberedMinions = [];\r\n\t\tfor (const target of targets) {\r\n\t\t\tconst copy = copyEntity(target);\r\n\t\t\tremoveAurasFromSelf(copy, input.playerBoard, input.playerEntity, input.gameState);\r\n\t\t\ttrinket.rememberedMinions.push(copy);\r\n\t\t\ttarget.definitelyDead = true;\r\n\t\t}\r\n\t\treturn true;\r\n\t},\r\n\tonAfterFriendlyMinionDeath: (trinket: BoardTrinket, input: OnAfterFriendlyMinionDeathInput) => {\r\n\t\tif (input.board.length > 0 || trinket.rememberedMinions?.length === 0) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tfor (const minion of trinket.rememberedMinions) {\r\n\t\t\tsimplifiedSpawnEntitiesWithAddToBoard(\r\n\t\t\t\tminion.cardId,\r\n\t\t\t\t1,\r\n\t\t\t\t{\r\n\t\t\t\t\tboardWithDeadEntity: input.board,\r\n\t\t\t\t\tboardWithDeadEntityHero: input.hero,\r\n\t\t\t\t\totherBoard: input.otherBoard,\r\n\t\t\t\t\totherBoardHero: input.otherHero,\r\n\t\t\t\t\tgameState: input.gameState,\r\n\t\t\t\t\tdeadEntity: minion,\r\n\t\t\t\t},\r\n\t\t\t\ttrinket,\r\n\t\t\t\t0,\r\n\t\t\t\tminion,\r\n\t\t\t);\r\n\t\t}\r\n\t\ttrinket.rememberedMinions = [];\r\n\t},\r\n};\r\n"]}
@@ -31,7 +31,7 @@ const cloneBoard = (board) => {
31
31
  questRewards: (_c = board.player.questRewards) === null || _c === void 0 ? void 0 : _c.map((reward) => reward),
32
32
  hand: (_d = board.player.hand) === null || _d === void 0 ? void 0 : _d.map((entity) => cloneEntity(entity)),
33
33
  secrets: (_e = board.player.secrets) === null || _e === void 0 ? void 0 : _e.map((secret) => ({ ...secret })).sort((a, b) => a.entityId - b.entityId),
34
- trinkets: (_f = board.player.trinkets) === null || _f === void 0 ? void 0 : _f.map((trinket) => ({ ...trinket })),
34
+ trinkets: (_f = board.player.trinkets) === null || _f === void 0 ? void 0 : _f.map((trinket) => ({ ...trinket, tags: { ...trinket.tags } })),
35
35
  globalInfo: { ...board.player.globalInfo },
36
36
  heroPowers: (_g = board.player.heroPowers) === null || _g === void 0 ? void 0 : _g.map((heroPower) => ({ ...heroPower })),
37
37
  },
@@ -1 +1 @@
1
- {"version":3,"file":"input-clone.js","sourceRoot":"","sources":["../src/input-clone.ts"],"names":[],"mappings":";;;AAWO,MAAM,WAAW,GAAG,CAAC,KAAoB,EAAiB,EAAE;IAClE,MAAM,MAAM,GAAkB;QAC7B,SAAS,EAAE;YACV,WAAW,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW;YACxC,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC,SAAS;YACpC,WAAW,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW;SACxC;QACD,WAAW,EAAE,KAAK,CAAC,WAAW;QAC9B,WAAW,EAAE,IAAA,kBAAU,EAAC,KAAK,CAAC,WAAW,CAAC;QAC1C,aAAa,EAAE,IAAA,kBAAU,EAAC,KAAK,CAAC,aAAa,CAAC;QAC9C,mBAAmB,EAAE,IAAA,kBAAU,EAAC,KAAK,CAAC,mBAAmB,CAAC;QAC1D,qBAAqB,EAAE,IAAA,kBAAU,EAAC,KAAK,CAAC,qBAAqB,CAAC;QAC9D,OAAO,EAAE,IAAI;KACb,CAAC;IACF,OAAO,MAAM,CAAC;AACf,CAAC,CAAC;AAfW,QAAA,WAAW,eAetB;AAEK,MAAM,UAAU,GAAG,CAAC,KAAmB,EAAgB,EAAE;;IAC/D,IAAI,CAAC,KAAK,EAAE;QACX,OAAO,IAAI,CAAC;KACZ;IACD,MAAM,MAAM,GAAiB;QAC5B,MAAM,EAAE;YACP,GAAG,KAAK,CAAC,MAAM;YACf,aAAa,EAAE,MAAA,KAAK,CAAC,MAAM,CAAC,aAAa,0CAAE,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,EAAE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U,cAmBrB;AAEF,MAAM,WAAW,GAAG,CAAC,MAAmB,EAAe,EAAE;;IACxD,MAAM,MAAM,GAAgB;QAC3B,GAAG,MAAM;QACT,YAAY,EAAE,MAAM,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;QACpE,kBAAkB,EAAE,EAAE;QACtB,eAAe,EAAE,MAAA,MAAM,CAAC,eAAe,0CAAE,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC;QAC5D,sBAAsB,EAAE,EAAE;KAC1B,CAAC;IACF,OAAO,MAAM,CAAC;AACf,CAAC,CAAC","sourcesContent":["import { BgsBattleInfo } from './bgs-battle-info';\r\nimport { BgsBoardInfo } from './bgs-board-info';\r\nimport { BoardEntity } from './board-entity';\r\n\r\n// const cloneInput = (input: BgsBattleInfo): BgsBattleInfo => {\r\n// \treturn structuredClone(input);\r\n// };\r\n// const cloneInput2 = (input: string): BgsBattleInfo => {\r\n// \treturn JSON.parse(input);\r\n// };\r\n\r\nexport const cloneInput3 = (input: BgsBattleInfo): BgsBattleInfo => {\r\n\tconst result: BgsBattleInfo = {\r\n\t\tgameState: {\r\n\t\t\tcurrentTurn: input.gameState.currentTurn,\r\n\t\t\tanomalies: input.gameState.anomalies,\r\n\t\t\tvalidTribes: input.gameState.validTribes,\r\n\t\t},\r\n\t\theroHasDied: input.heroHasDied,\r\n\t\tplayerBoard: cloneBoard(input.playerBoard),\r\n\t\topponentBoard: cloneBoard(input.opponentBoard),\r\n\t\tplayerTeammateBoard: cloneBoard(input.playerTeammateBoard),\r\n\t\topponentTeammateBoard: cloneBoard(input.opponentTeammateBoard),\r\n\t\toptions: null,\r\n\t};\r\n\treturn result;\r\n};\r\n\r\nexport const cloneBoard = (board: BgsBoardInfo): BgsBoardInfo => {\r\n\tif (!board) {\r\n\t\treturn null;\r\n\t}\r\n\tconst result: BgsBoardInfo = {\r\n\t\tplayer: {\r\n\t\t\t...board.player,\r\n\t\t\tquestEntities: board.player.questEntities?.map((quest) => ({ ...quest })),\r\n\t\t\tquestRewardEntities: board.player.questRewardEntities?.map((reward) => ({ ...reward })),\r\n\t\t\tquestRewards: board.player.questRewards?.map((reward) => reward),\r\n\t\t\thand: board.player.hand?.map((entity) => cloneEntity(entity)),\r\n\t\t\tsecrets: board.player.secrets?.map((secret) => ({ ...secret })).sort((a, b) => a.entityId - b.entityId),\r\n\t\t\ttrinkets: board.player.trinkets?.map((trinket) => ({ ...trinket })),\r\n\t\t\tglobalInfo: { ...board.player.globalInfo },\r\n\t\t\theroPowers: board.player.heroPowers?.map((heroPower) => ({ ...heroPower })),\r\n\t\t},\r\n\t\tboard: board.board.map((entity) => cloneEntity(entity)),\r\n\t};\r\n\treturn result;\r\n};\r\n\r\nconst cloneEntity = (entity: BoardEntity): BoardEntity => {\r\n\tconst result: BoardEntity = {\r\n\t\t...entity,\r\n\t\tenchantments: entity.enchantments.map((enchant) => ({ ...enchant })),\r\n\t\tpendingAttackBuffs: [],\r\n\t\tadditionalCards: entity.additionalCards?.map((card) => card),\r\n\t\trememberedDeathrattles: [],\r\n\t};\r\n\treturn result;\r\n};\r\n"]}
1
+ {"version":3,"file":"input-clone.js","sourceRoot":"","sources":["../src/input-clone.ts"],"names":[],"mappings":";;;AAWO,MAAM,WAAW,GAAG,CAAC,KAAoB,EAAiB,EAAE;IAClE,MAAM,MAAM,GAAkB;QAC7B,SAAS,EAAE;YACV,WAAW,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW;YACxC,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC,SAAS;YACpC,WAAW,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW;SACxC;QACD,WAAW,EAAE,KAAK,CAAC,WAAW;QAC9B,WAAW,EAAE,IAAA,kBAAU,EAAC,KAAK,CAAC,WAAW,CAAC;QAC1C,aAAa,EAAE,IAAA,kBAAU,EAAC,KAAK,CAAC,aAAa,CA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AAE,MAAA,KAAK,CAAC,MAAM,CAAC,QAAQ,0CAAE,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,OAAO,EAAE,IAAI,EAAE,EAAE,GAAG,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;YAC9F,UAAU,EAAE,EAAE,GAAG,KAAK,CAAC,MAAM,CAAC,UAAU,EAAE;YAC1C,UAAU,EAAE,MAAA,KAAK,CAAC,MAAM,CAAC,UAAU,0CAAE,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,SAAS,EAAE,CAAC,CAAC;SAC3E;QACD,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;KACvD,CAAC;IACF,OAAO,MAAM,CAAC;AACf,CAAC,CAAC;AAnBW,QAAA,UAAU,cAmBrB;AAEF,MAAM,WAAW,GAAG,CAAC,MAAmB,EAAe,EAAE;;IACxD,MAAM,MAAM,GAAgB;QAC3B,GAAG,MAAM;QACT,YAAY,EAAE,MAAM,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;QACpE,kBAAkB,EAAE,EAAE;QACtB,eAAe,EAAE,MAAA,MAAM,CAAC,eAAe,0CAAE,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC;QAC5D,sBAAsB,EAAE,EAAE;KAC1B,CAAC;IACF,OAAO,MAAM,CAAC;AACf,CAAC,CAAC","sourcesContent":["import { BgsBattleInfo } from './bgs-battle-info';\r\nimport { BgsBoardInfo } from './bgs-board-info';\r\nimport { BoardEntity } from './board-entity';\r\n\r\n// const cloneInput = (input: BgsBattleInfo): BgsBattleInfo => {\r\n// \treturn structuredClone(input);\r\n// };\r\n// const cloneInput2 = (input: string): BgsBattleInfo => {\r\n// \treturn JSON.parse(input);\r\n// };\r\n\r\nexport const cloneInput3 = (input: BgsBattleInfo): BgsBattleInfo => {\r\n\tconst result: BgsBattleInfo = {\r\n\t\tgameState: {\r\n\t\t\tcurrentTurn: input.gameState.currentTurn,\r\n\t\t\tanomalies: input.gameState.anomalies,\r\n\t\t\tvalidTribes: input.gameState.validTribes,\r\n\t\t},\r\n\t\theroHasDied: input.heroHasDied,\r\n\t\tplayerBoard: cloneBoard(input.playerBoard),\r\n\t\topponentBoard: cloneBoard(input.opponentBoard),\r\n\t\tplayerTeammateBoard: cloneBoard(input.playerTeammateBoard),\r\n\t\topponentTeammateBoard: cloneBoard(input.opponentTeammateBoard),\r\n\t\toptions: null,\r\n\t};\r\n\treturn result;\r\n};\r\n\r\nexport const cloneBoard = (board: BgsBoardInfo): BgsBoardInfo => {\r\n\tif (!board) {\r\n\t\treturn null;\r\n\t}\r\n\tconst result: BgsBoardInfo = {\r\n\t\tplayer: {\r\n\t\t\t...board.player,\r\n\t\t\tquestEntities: board.player.questEntities?.map((quest) => ({ ...quest })),\r\n\t\t\tquestRewardEntities: board.player.questRewardEntities?.map((reward) => ({ ...reward })),\r\n\t\t\tquestRewards: board.player.questRewards?.map((reward) => reward),\r\n\t\t\thand: board.player.hand?.map((entity) => cloneEntity(entity)),\r\n\t\t\tsecrets: board.player.secrets?.map((secret) => ({ ...secret })).sort((a, b) => a.entityId - b.entityId),\r\n\t\t\ttrinkets: board.player.trinkets?.map((trinket) => ({ ...trinket, tags: { ...trinket.tags } })),\r\n\t\t\tglobalInfo: { ...board.player.globalInfo },\r\n\t\t\theroPowers: board.player.heroPowers?.map((heroPower) => ({ ...heroPower })),\r\n\t\t},\r\n\t\tboard: board.board.map((entity) => cloneEntity(entity)),\r\n\t};\r\n\treturn result;\r\n};\r\n\r\nconst cloneEntity = (entity: BoardEntity): BoardEntity => {\r\n\tconst result: BoardEntity = {\r\n\t\t...entity,\r\n\t\tenchantments: entity.enchantments.map((enchant) => ({ ...enchant })),\r\n\t\tpendingAttackBuffs: [],\r\n\t\tadditionalCards: entity.additionalCards?.map((card) => card),\r\n\t\trememberedDeathrattles: [],\r\n\t};\r\n\treturn result;\r\n};\r\n"]}
@@ -128,10 +128,6 @@ const simulateBattle = function* (battleInput, cards, cardsData) {
128
128
  };
129
129
  const simulator = new simulator_1.Simulator(gameState);
130
130
  const battleResult = simulator.simulateSingleBattle(gameState.gameState.player, gameState.gameState.opponent);
131
- if (Date.now() - start > maxAcceptableDuration && !hideMaxSimulationDurationWarning) {
132
- console.warn('Stopping simulation after', i, 'iterations and ', Date.now() - start, 'ms');
133
- break;
134
- }
135
131
  if (!battleResult) {
136
132
  continue;
137
133
  }
@@ -157,6 +153,10 @@ const simulateBattle = function* (battleInput, cards, cardsData) {
157
153
  simulationResult.tied++;
158
154
  }
159
155
  spectator.commitBattleResult(battleResult.result);
156
+ if (Date.now() - start > maxAcceptableDuration && !hideMaxSimulationDurationWarning) {
157
+ console.warn('Stopping simulation after', i, 'iterations and ', Date.now() - start, 'ms');
158
+ break;
159
+ }
160
160
  if (!!intermediateSteps && i > 0 && i % intermediateSteps === 0) {
161
161
  updateSimulationResult(simulationResult, inputReady, damageConfidence);
162
162
  yield simulationResult;
@@ -1 +1 @@
1
- {"version":3,"file":"simulate-bgs-battle.js","sourceRoot":"","sources":["../src/simulate-bgs-battle.ts"],"names":[],"mappings":";;;AACA,iEAA+D;AAE/D,2DAAwE;AACxE,mDAA+C;AAC/C,gEAA2D;AAC3D,+CAA2C;AAC3C,+CAA4C;AAC5C,yDAAqD;AAIrD,4DAAwD;AACxD,sDAAmD;AACnD,gEAA6D;AAE7D,IAAI,WAAW,GAAG,IAAI,gCAAe,EAAE,CAAC;AAEjC,MAAM,WAAW,GAAG,CAAC,KAAsB,EAAE,EAAE;IACrD,WAAW,GAAG,KAAK,CAAC;AACrB,CAAC,CAAC;AAFW,QAAA,WAAW,eAEtB;AAKF,kBAAe,KAAK,EAAE,KAAK,EAAgB,EAA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AAC,MAAM,CAAC,6BAAY,CAAC,EAAE;YAEnD,IAAI,IAAA,+CAA8B,EAAC,QAAQ,CAAC,EAAE;gBAC7C,uCAAuC,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAC;aAClE;SACD;KACD;IACD,OAAO,uCAAuC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;AACjE,CAAC,CAAC;AAbW,QAAA,6BAA6B,iCAaxC","sourcesContent":["/* eslint-disable @typescript-eslint/no-use-before-define */\nimport { AllCardsService } from '@firestone-hs/reference-data';\nimport { BgsBattleInfo } from './bgs-battle-info';\nimport { hasDeathrattleSpawnEnchantment } from './cards/card.interface';\nimport { CardsData } from './cards/cards-data';\nimport { cardMappings } from './cards/impl/_card-mappings';\nimport { debugState } from './debug-state';\nimport { cloneInput3 } from './input-clone';\nimport { buildFinalInput } from './input-sanitation';\nimport { CardIds } from './services/card-ids';\nimport { SimulationResult } from './simulation-result';\nimport { FullGameState } from './simulation/internal-game-state';\nimport { SharedState } from './simulation/shared-state';\nimport { Simulator } from './simulation/simulator';\nimport { Spectator } from './simulation/spectator/spectator';\n\nlet globalCards = new AllCardsService();\n\nexport const assignCards = (cards: AllCardsService) => {\n\tglobalCards = cards;\n};\n\n// This example demonstrates a NodeJS 8.10 async handler[1], however of course you could use\n// the more traditional callback-style handler.\n// [1]: https://aws.amazon.com/blogs/compute/node-js-8-10-runtime-now-available-in-aws-lambda/\nexport default async (event): Promise<any> => {\n\tif (!event.body?.length) {\n\t\tconsole.warn('missing event body', event);\n\t\treturn;\n\t}\n\n\tconst battleInput: BgsBattleInfo = JSON.parse(event.body);\n\tconst cards = globalCards;\n\tawait cards.initializeCardsDb();\n\tconst cardsData = new CardsData(cards, false);\n\tcardsData.inititialize(\n\t\tbattleInput.gameState?.validTribes ?? battleInput.options?.validTribes,\n\t\tbattleInput.gameState?.anomalies ?? [],\n\t);\n\tconst battleIterator = simulateBattle(battleInput, cards, cardsData);\n\n\t// Iterate through all intermediate results to reach the final result\n\tlet result = battleIterator.next();\n\twhile (!result.done) {\n\t\tresult = battleIterator.next();\n\t}\n\n\tconst simulationResult = result.value;\n\t// console.debug('simulationResult', simulationResult);\n\n\tconst response = {\n\t\tstatusCode: 200,\n\t\tisBase64Encoded: false,\n\t\tbody: JSON.stringify(simulationResult),\n\t};\n\treturn response;\n};\n\nexport const simulateBattle = function* (\n\tbattleInput: BgsBattleInfo,\n\tcards: AllCardsService,\n\tcardsData: CardsData,\n): Generator<SimulationResult, SimulationResult, void> {\n\tif (!cards?.getCards()?.length) {\n\t\tconsole.error('[simulate-bgs-battle] reference cards are empty, cannot simulate battle', cards);\n\t\treturn null;\n\t}\n\t// !battleInput.options?.skipInfoLogs && console.time('full-sim');\n\tconst start = Date.now();\n\tconst maxAcceptableDuration = battleInput.options?.maxAcceptableDuration || 8000;\n\tconst hideMaxSimulationDurationWarning = battleInput.options?.hideMaxSimulationDurationWarning ?? false;\n\tconst numberOfSimulations = battleInput.options?.numberOfSimulations || 8000;\n\tconst intermediateSteps = battleInput.options?.intermediateResults ?? 200;\n\tconst damageConfidence = battleInput.options?.damageConfidence ?? 0.9;\n\tconst includeOutcomeSamples = battleInput.options?.includeOutcomeSamples ?? true;\n\tconst simulationResult: SimulationResult = {\n\t\twonLethal: 0,\n\t\twon: 0,\n\t\ttied: 0,\n\t\tlost: 0,\n\t\tlostLethal: 0,\n\t\tdamageWons: [],\n\t\tdamageWon: 0,\n\t\tdamageWonRange: null,\n\t\tdamageLosts: [],\n\t\tdamageLost: 0,\n\t\tdamageLostRange: null,\n\t\twonLethalPercent: undefined,\n\t\twonPercent: undefined,\n\t\ttiedPercent: undefined,\n\t\tlostPercent: undefined,\n\t\tlostLethalPercent: undefined,\n\t\taverageDamageWon: undefined,\n\t\taverageDamageLost: undefined,\n\t};\n\n\tconst spectator = new Spectator(includeOutcomeSamples);\n\tconst inputReady = buildFinalInput(battleInput, cards, cardsData);\n\n\t// Apply debug state from input when present (e.g. from bug report)\n\tif (battleInput.debugState) {\n\t\tdebugState.active = true;\n\t\tdebugState.forcedCurrentAttacker = battleInput.debugState.forcedCurrentAttacker;\n\t\tdebugState.forcedFaceOffBase = battleInput.debugState.forcedFaceOffBase.map((f) => ({\n\t\t\tattacker: { ...f.attacker },\n\t\t\tdefender: { ...f.defender },\n\t\t}));\n\t\tconst rawPicks = battleInput.debugState.forcedRandomPicks ?? [];\n\t\tdebugState.forcedRandomPicksBase = rawPicks.map((p) => ({\n\t\t\tsource: { ...p.source },\n\t\t\ttarget: { ...p.target },\n\t\t\t...(p.chosenCardId && { chosenCardId: p.chosenCardId }),\n\t\t}));\n\t}\n\n\ttry {\n\t\t!battleInput.options?.skipInfoLogs && console.time('simulation');\n\t\tconst outcomes = {};\n\t\tfor (let i = 0; i < numberOfSimulations; i++) {\n\t\t\tconst input: BgsBattleInfo = cloneInput3(inputReady);\n\t\t\tconst inputClone: BgsBattleInfo = cloneInput3(inputReady);\n\t\t\tconst gameState: FullGameState = {\n\t\t\t\tallCards: cards,\n\t\t\t\tcardsData: cardsData,\n\t\t\t\tspectator: spectator,\n\t\t\t\tsharedState: new SharedState(),\n\t\t\t\tcurrentTurn: input.gameState.currentTurn,\n\t\t\t\tvalidTribes: input.gameState.validTribes,\n\t\t\t\tanomalies: input.gameState.anomalies,\n\t\t\t\tgameState: {\n\t\t\t\t\tplayer: {\n\t\t\t\t\t\tplayer: input.playerBoard.player,\n\t\t\t\t\t\tboard: input.playerBoard.board,\n\t\t\t\t\t\tteammate: input.playerTeammateBoard,\n\t\t\t\t\t},\n\t\t\t\t\topponent: {\n\t\t\t\t\t\tplayer: input.opponentBoard.player,\n\t\t\t\t\t\tboard: input.opponentBoard.board,\n\t\t\t\t\t\tteammate: input.opponentTeammateBoard,\n\t\t\t\t\t},\n\t\t\t\t\tplayerInitial: {\n\t\t\t\t\t\tplayer: inputClone.playerBoard.player,\n\t\t\t\t\t\tboard: inputClone.playerBoard.board,\n\t\t\t\t\t\tteammate: inputClone.playerTeammateBoard,\n\t\t\t\t\t},\n\t\t\t\t\topponentInitial: {\n\t\t\t\t\t\tplayer: inputClone.opponentBoard.player,\n\t\t\t\t\t\tboard: inputClone.opponentBoard.board,\n\t\t\t\t\t\tteammate: inputClone.opponentTeammateBoard,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t};\n\t\t\tconst simulator = new Simulator(gameState);\n\t\t\tconst battleResult = simulator.simulateSingleBattle(\n\t\t\t\tgameState.gameState.player,\n\t\t\t\tgameState.gameState.opponent,\n\t\t\t);\n\t\t\tif (Date.now() - start > maxAcceptableDuration && !hideMaxSimulationDurationWarning) {\n\t\t\t\t// Can happen in case of inifinite boards, or a bug. Don't hog the user's computer in that case\n\t\t\t\tconsole.warn('Stopping simulation after', i, 'iterations and ', Date.now() - start, 'ms');\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (!battleResult) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (battleResult.result === 'won') {\n\t\t\t\tsimulationResult.won++;\n\t\t\t\tsimulationResult.damageWon += battleResult.damageDealt;\n\t\t\t\tsimulationResult.damageWons.push(battleResult.damageDealt);\n\t\t\t\tif (battleResult.damageDealt >= battleInput.opponentBoard.player.hpLeft) {\n\t\t\t\t\tsimulationResult.wonLethal++;\n\t\t\t\t}\n\t\t\t} else if (battleResult.result === 'lost') {\n\t\t\t\tsimulationResult.lost++;\n\t\t\t\tsimulationResult.damageLost += battleResult.damageDealt;\n\t\t\t\tsimulationResult.damageLosts.push(battleResult.damageDealt);\n\t\t\t\toutcomes[battleResult.damageDealt] = (outcomes[battleResult.damageDealt] ?? 0) + 1;\n\t\t\t\tif (\n\t\t\t\t\tbattleInput.playerBoard.player.hpLeft &&\n\t\t\t\t\tbattleResult.damageDealt >= battleInput.playerBoard.player.hpLeft\n\t\t\t\t) {\n\t\t\t\t\tsimulationResult.lostLethal++;\n\t\t\t\t}\n\t\t\t} else if (battleResult.result === 'tied') {\n\t\t\t\tsimulationResult.tied++;\n\t\t\t}\n\t\t\tspectator.commitBattleResult(battleResult.result);\n\n\t\t\t// Yield intermediate result every 200 iterations\n\t\t\tif (!!intermediateSteps && i > 0 && i % intermediateSteps === 0) {\n\t\t\t\tupdateSimulationResult(simulationResult, inputReady, damageConfidence);\n\t\t\t\tyield simulationResult;\n\t\t\t}\n\t\t}\n\t\tupdateSimulationResult(simulationResult, inputReady, damageConfidence);\n\t\t!battleInput.options?.skipInfoLogs && console.timeEnd('simulation');\n\t\tspectator.prune();\n\t\tsimulationResult.outcomeSamples = spectator.buildOutcomeSamples(battleInput.gameState);\n\t\t// Avoid sending this verbose data\n\n\t\tsimulationResult.damageWons = [];\n\t\tsimulationResult.damageLosts = [];\n\t\t// !battleInput.options?.skipInfoLogs && console.timeEnd('full-sim');\n\t\treturn simulationResult;\n\t} finally {\n\t\tif (battleInput.debugState) {\n\t\t\tdebugState.active = false;\n\t\t}\n\t}\n};\n\nconst updateSimulationResult = (simulationResult: SimulationResult, input: BgsBattleInfo, damageConfidence: number) => {\n\tconst totalMatches = simulationResult.won + simulationResult.tied + simulationResult.lost;\n\tsimulationResult.wonPercent = checkRounding(\n\t\tMath.round((10 * (100 * simulationResult.won)) / totalMatches) / 10,\n\t\tsimulationResult.won,\n\t\ttotalMatches,\n\t);\n\tsimulationResult.wonLethalPercent = checkRounding(\n\t\tMath.round((10 * (100 * simulationResult.wonLethal)) / totalMatches) / 10,\n\t\tsimulationResult.wonLethal,\n\t\ttotalMatches,\n\t);\n\tsimulationResult.lostPercent = checkRounding(\n\t\tMath.round((10 * (100 * simulationResult.lost)) / totalMatches) / 10,\n\t\tsimulationResult.lost,\n\t\ttotalMatches,\n\t);\n\tsimulationResult.lostLethalPercent = checkRounding(\n\t\tMath.round((10 * (100 * simulationResult.lostLethal)) / totalMatches) / 10,\n\t\tsimulationResult.lostLethal,\n\t\ttotalMatches,\n\t);\n\tsimulationResult.tiedPercent = checkRounding(\n\t\tMath.max(0, 100 - simulationResult.lostPercent - simulationResult.wonPercent),\n\t\tsimulationResult.tied,\n\t\ttotalMatches,\n\t);\n\n\t// simulationResult.wonLethalPercent = Math.round((10 * (100 * simulationResult.wonLethal)) / totalMatches) / 10;\n\t// simulationResult.lostLethalPercent = Math.round((10 * (100 * simulationResult.lostLethal)) / totalMatches) / 10;\n\tconst totalDamageWon = simulationResult.damageWons.reduce((a, b) => a + b, 0);\n\tconst totalDamageLost = simulationResult.damageLosts.reduce((a, b) => a + b, 0);\n\tconst damageWonRange = calculateDamageRange(simulationResult.damageWons, damageConfidence);\n\tconst damageLostRange = calculateDamageRange(simulationResult.damageLosts, damageConfidence);\n\tsimulationResult.averageDamageWon = simulationResult.won ? totalDamageWon / simulationResult.won : 0;\n\tsimulationResult.averageDamageLost = simulationResult.lost ? totalDamageLost / simulationResult.lost : 0;\n\tsimulationResult.damageWonRange = simulationResult.won ? damageWonRange : null;\n\tsimulationResult.damageLostRange = simulationResult.lost ? damageLostRange : null;\n\n\tif (\n\t\tsimulationResult.averageDamageWon > 0 &&\n\t\tsimulationResult.averageDamageWon < input.playerBoard.player.tavernTier\n\t) {\n\t\tconsole.warn('average damage won issue');\n\t}\n\tif (\n\t\tsimulationResult.averageDamageLost > 0 &&\n\t\tsimulationResult.averageDamageLost < input.opponentBoard.player.tavernTier\n\t) {\n\t\tconsole.warn('average damage lost issue');\n\t}\n};\n\nconst calculateDamageRange = (damageArray: number[], damageConfidence: number): { min: number; max: number } => {\n\tif (damageArray.length === 0) {\n\t\treturn { min: 0, max: 0 };\n\t}\n\n\t// Sort the array\n\tconst sortedDamage = [...damageArray].sort((a, b) => a - b);\n\n\t// Calculate the 10th and 90th percentiles\n\tconst percentile = (arr: number[], p: number) => {\n\t\tconst index = Math.floor(p * arr.length);\n\t\treturn arr[index];\n\t};\n\n\tconst minDamage = percentile(sortedDamage, 1 - damageConfidence);\n\tconst maxDamage = percentile(sortedDamage, damageConfidence);\n\n\treturn { min: minDamage, max: maxDamage };\n};\n\nconst checkRounding = (roundedValue: number, initialValue: number, totalValue: number): number => {\n\tif (roundedValue === 0 && initialValue !== 0) {\n\t\treturn 0.01;\n\t}\n\tif (roundedValue === 100 && initialValue !== totalValue) {\n\t\treturn 99.9;\n\t}\n\treturn roundedValue;\n};\n\n// Used when triggering random deathrattles\nconst VALID_DEATHRATTLE_ENCHANTMENTS = [\n\tCardIds.ReplicatingMenace_ReplicatingMenaceEnchantment_BG_BOT_312e,\n\tCardIds.ReplicatingMenace_ReplicatingMenaceEnchantment_TB_BaconUps_032e,\n\tCardIds.LivingSpores_LivingSporesEnchantment,\n\tCardIds.Leapfrogger_LeapfrogginEnchantment_BG21_000e,\n\tCardIds.Leapfrogger_LeapfrogginEnchantment_BG21_000_Ge,\n\tCardIds.Sneed_SneedsReplicator,\n\tCardIds.SneedsReplicator_ReplicateEnchantment,\n\tCardIds.EarthRecollectionEnchantment, // Spirit Raptor\n\tCardIds.FireRecollectionEnchantment,\n\tCardIds.LightningRecollectionEnchantment,\n\tCardIds.WaterRecollectionEnchantment,\n\tCardIds.EarthInvocation_ElementEarthEnchantment, // Summon a 1/1\n\tCardIds.LightningInvocation, // Deal 1 damage to 5 enemy minions\n\t// CardIds.SurfNSurf_CrabRidingEnchantment_BG27_004e,\n\t// CardIds.SurfNSurf_CrabRidingEnchantment_BG27_004_Ge,\n\t// CardIds.RecurringNightmare_NightmareInsideEnchantment_BG26_055e,\n\t// CardIds.RecurringNightmare_NightmareInsideEnchantment_BG26_055_Ge,\n\tCardIds.BoonOfBeetles_BeetleSwarmEnchantment_BG28_603e,\n\tCardIds.RustyTrident_TridentsTreasureEnchantment_BG30_MagicItem_917e,\n\tCardIds.HoggyBank_GemInTheBankEnchantment_BG30_MagicItem_411e,\n\tCardIds.JarredFrostling_FrostyGlobeEnchantment_BG30_MagicItem_952e,\n\tCardIds.CaduceusReactor_CaduceusReactorEnchantment_BG31_HERO_801ptee,\n\tCardIds.AutoAssembler_AutoAssemblerEnchantment_BG32_172e,\n\tCardIds.AutoAssembler_AutoAssemblerEnchantment_BG32_172_Ge,\n\tCardIds.TamsinRoame_ImpendingSacrificeEnchantment_BG20_HERO_282e2,\n];\nconst validDeathrattleEnchantmentsFromMapping = [];\nexport const isValidDeathrattleEnchantment = (cardId: string): boolean => {\n\tif (VALID_DEATHRATTLE_ENCHANTMENTS.includes(cardId as CardIds)) {\n\t\treturn true;\n\t}\n\tif (validDeathrattleEnchantmentsFromMapping.length === 0) {\n\t\tfor (const cardImpl of Object.values(cardMappings)) {\n\t\t\t// Also includes non-enchantments, but since we only match this against the enchants list, it's fine\n\t\t\tif (hasDeathrattleSpawnEnchantment(cardImpl)) {\n\t\t\t\tvalidDeathrattleEnchantmentsFromMapping.push(...cardImpl.cardIds);\n\t\t\t}\n\t\t}\n\t}\n\treturn validDeathrattleEnchantmentsFromMapping.includes(cardId);\n};\n\n// const cleanEnchantmentsForEntity = (\n// \tenchantments: { cardId: string; originEntityId?: number; timing: number }[],\n// \tentityIds: readonly number[],\n// ): { cardId: string; originEntityId?: number; timing: number }[] => {\n// \treturn enchantments.filter(\n// \t\t(enchant) =>\n// \t\t\tentityIds.indexOf(enchant.originEntityId) !== -1 ||\n// \t\t\tvalidEnchantments.indexOf(enchant.cardId as CardIds) !== -1,\n// \t);\n// };\n"]}
1
+ {"version":3,"file":"simulate-bgs-battle.js","sourceRoot":"","sources":["../src/simulate-bgs-battle.ts"],"names":[],"mappings":";;;AACA,iEAA+D;AAE/D,2DAAwE;AACxE,mDAA+C;AAC/C,gEAA2D;AAC3D,+CAA2C;AAC3C,+CAA4C;AAC5C,yDAAqD;AAIrD,4DAAwD;AACxD,sDAAmD;AACnD,gEAA6D;AAE7D,IAAI,WAAW,GAAG,IAAI,gCAAe,EAAE,CAAC;AAEjC,MAAM,WAAW,GAAG,CAAC,KAAsB,EAAE,EAAE;IACrD,WAAW,GAAG,KAAK,CAAC;AACrB,CAAC,CAAC;AAFW,QAAA,WAAW,eAEtB;AAKF,kBAAe,KAAK,EAAE,KAAK,EAAgB,EAAE;;IAC5C,IAA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C,6BAAY,CAAC,EAAE;YAEnD,IAAI,IAAA,+CAA8B,EAAC,QAAQ,CAAC,EAAE;gBAC7C,uCAAuC,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAC;aAClE;SACD;KACD;IACD,OAAO,uCAAuC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;AACjE,CAAC,CAAC;AAbW,QAAA,6BAA6B,iCAaxC","sourcesContent":["/* eslint-disable @typescript-eslint/no-use-before-define */\nimport { AllCardsService } from '@firestone-hs/reference-data';\nimport { BgsBattleInfo } from './bgs-battle-info';\nimport { hasDeathrattleSpawnEnchantment } from './cards/card.interface';\nimport { CardsData } from './cards/cards-data';\nimport { cardMappings } from './cards/impl/_card-mappings';\nimport { debugState } from './debug-state';\nimport { cloneInput3 } from './input-clone';\nimport { buildFinalInput } from './input-sanitation';\nimport { CardIds } from './services/card-ids';\nimport { SimulationResult } from './simulation-result';\nimport { FullGameState } from './simulation/internal-game-state';\nimport { SharedState } from './simulation/shared-state';\nimport { Simulator } from './simulation/simulator';\nimport { Spectator } from './simulation/spectator/spectator';\n\nlet globalCards = new AllCardsService();\n\nexport const assignCards = (cards: AllCardsService) => {\n\tglobalCards = cards;\n};\n\n// This example demonstrates a NodeJS 8.10 async handler[1], however of course you could use\n// the more traditional callback-style handler.\n// [1]: https://aws.amazon.com/blogs/compute/node-js-8-10-runtime-now-available-in-aws-lambda/\nexport default async (event): Promise<any> => {\n\tif (!event.body?.length) {\n\t\tconsole.warn('missing event body', event);\n\t\treturn;\n\t}\n\n\tconst battleInput: BgsBattleInfo = JSON.parse(event.body);\n\tconst cards = globalCards;\n\tawait cards.initializeCardsDb();\n\tconst cardsData = new CardsData(cards, false);\n\tcardsData.inititialize(\n\t\tbattleInput.gameState?.validTribes ?? battleInput.options?.validTribes,\n\t\tbattleInput.gameState?.anomalies ?? [],\n\t);\n\tconst battleIterator = simulateBattle(battleInput, cards, cardsData);\n\n\t// Iterate through all intermediate results to reach the final result\n\tlet result = battleIterator.next();\n\twhile (!result.done) {\n\t\tresult = battleIterator.next();\n\t}\n\n\tconst simulationResult = result.value;\n\t// console.debug('simulationResult', simulationResult);\n\n\tconst response = {\n\t\tstatusCode: 200,\n\t\tisBase64Encoded: false,\n\t\tbody: JSON.stringify(simulationResult),\n\t};\n\treturn response;\n};\n\nexport const simulateBattle = function* (\n\tbattleInput: BgsBattleInfo,\n\tcards: AllCardsService,\n\tcardsData: CardsData,\n): Generator<SimulationResult, SimulationResult, void> {\n\tif (!cards?.getCards()?.length) {\n\t\tconsole.error('[simulate-bgs-battle] reference cards are empty, cannot simulate battle', cards);\n\t\treturn null;\n\t}\n\t// !battleInput.options?.skipInfoLogs && console.time('full-sim');\n\tconst start = Date.now();\n\tconst maxAcceptableDuration = battleInput.options?.maxAcceptableDuration || 8000;\n\tconst hideMaxSimulationDurationWarning = battleInput.options?.hideMaxSimulationDurationWarning ?? false;\n\tconst numberOfSimulations = battleInput.options?.numberOfSimulations || 8000;\n\tconst intermediateSteps = battleInput.options?.intermediateResults ?? 200;\n\tconst damageConfidence = battleInput.options?.damageConfidence ?? 0.9;\n\tconst includeOutcomeSamples = battleInput.options?.includeOutcomeSamples ?? true;\n\tconst simulationResult: SimulationResult = {\n\t\twonLethal: 0,\n\t\twon: 0,\n\t\ttied: 0,\n\t\tlost: 0,\n\t\tlostLethal: 0,\n\t\tdamageWons: [],\n\t\tdamageWon: 0,\n\t\tdamageWonRange: null,\n\t\tdamageLosts: [],\n\t\tdamageLost: 0,\n\t\tdamageLostRange: null,\n\t\twonLethalPercent: undefined,\n\t\twonPercent: undefined,\n\t\ttiedPercent: undefined,\n\t\tlostPercent: undefined,\n\t\tlostLethalPercent: undefined,\n\t\taverageDamageWon: undefined,\n\t\taverageDamageLost: undefined,\n\t};\n\n\tconst spectator = new Spectator(includeOutcomeSamples);\n\tconst inputReady = buildFinalInput(battleInput, cards, cardsData);\n\n\t// Apply debug state from input when present (e.g. from bug report)\n\tif (battleInput.debugState) {\n\t\tdebugState.active = true;\n\t\tdebugState.forcedCurrentAttacker = battleInput.debugState.forcedCurrentAttacker;\n\t\tdebugState.forcedFaceOffBase = battleInput.debugState.forcedFaceOffBase.map((f) => ({\n\t\t\tattacker: { ...f.attacker },\n\t\t\tdefender: { ...f.defender },\n\t\t}));\n\t\tconst rawPicks = battleInput.debugState.forcedRandomPicks ?? [];\n\t\tdebugState.forcedRandomPicksBase = rawPicks.map((p) => ({\n\t\t\tsource: { ...p.source },\n\t\t\ttarget: { ...p.target },\n\t\t\t...(p.chosenCardId && { chosenCardId: p.chosenCardId }),\n\t\t}));\n\t}\n\n\ttry {\n\t\t!battleInput.options?.skipInfoLogs && console.time('simulation');\n\t\tconst outcomes = {};\n\t\tfor (let i = 0; i < numberOfSimulations; i++) {\n\t\t\tconst input: BgsBattleInfo = cloneInput3(inputReady);\n\t\t\tconst inputClone: BgsBattleInfo = cloneInput3(inputReady);\n\t\t\tconst gameState: FullGameState = {\n\t\t\t\tallCards: cards,\n\t\t\t\tcardsData: cardsData,\n\t\t\t\tspectator: spectator,\n\t\t\t\tsharedState: new SharedState(),\n\t\t\t\tcurrentTurn: input.gameState.currentTurn,\n\t\t\t\tvalidTribes: input.gameState.validTribes,\n\t\t\t\tanomalies: input.gameState.anomalies,\n\t\t\t\tgameState: {\n\t\t\t\t\tplayer: {\n\t\t\t\t\t\tplayer: input.playerBoard.player,\n\t\t\t\t\t\tboard: input.playerBoard.board,\n\t\t\t\t\t\tteammate: input.playerTeammateBoard,\n\t\t\t\t\t},\n\t\t\t\t\topponent: {\n\t\t\t\t\t\tplayer: input.opponentBoard.player,\n\t\t\t\t\t\tboard: input.opponentBoard.board,\n\t\t\t\t\t\tteammate: input.opponentTeammateBoard,\n\t\t\t\t\t},\n\t\t\t\t\tplayerInitial: {\n\t\t\t\t\t\tplayer: inputClone.playerBoard.player,\n\t\t\t\t\t\tboard: inputClone.playerBoard.board,\n\t\t\t\t\t\tteammate: inputClone.playerTeammateBoard,\n\t\t\t\t\t},\n\t\t\t\t\topponentInitial: {\n\t\t\t\t\t\tplayer: inputClone.opponentBoard.player,\n\t\t\t\t\t\tboard: inputClone.opponentBoard.board,\n\t\t\t\t\t\tteammate: inputClone.opponentTeammateBoard,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t};\n\t\t\tconst simulator = new Simulator(gameState);\n\t\t\tconst battleResult = simulator.simulateSingleBattle(\n\t\t\t\tgameState.gameState.player,\n\t\t\t\tgameState.gameState.opponent,\n\t\t\t);\n\t\t\tif (!battleResult) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (battleResult.result === 'won') {\n\t\t\t\tsimulationResult.won++;\n\t\t\t\tsimulationResult.damageWon += battleResult.damageDealt;\n\t\t\t\tsimulationResult.damageWons.push(battleResult.damageDealt);\n\t\t\t\tif (battleResult.damageDealt >= battleInput.opponentBoard.player.hpLeft) {\n\t\t\t\t\tsimulationResult.wonLethal++;\n\t\t\t\t}\n\t\t\t} else if (battleResult.result === 'lost') {\n\t\t\t\tsimulationResult.lost++;\n\t\t\t\tsimulationResult.damageLost += battleResult.damageDealt;\n\t\t\t\tsimulationResult.damageLosts.push(battleResult.damageDealt);\n\t\t\t\toutcomes[battleResult.damageDealt] = (outcomes[battleResult.damageDealt] ?? 0) + 1;\n\t\t\t\tif (\n\t\t\t\t\tbattleInput.playerBoard.player.hpLeft &&\n\t\t\t\t\tbattleResult.damageDealt >= battleInput.playerBoard.player.hpLeft\n\t\t\t\t) {\n\t\t\t\t\tsimulationResult.lostLethal++;\n\t\t\t\t}\n\t\t\t} else if (battleResult.result === 'tied') {\n\t\t\t\tsimulationResult.tied++;\n\t\t\t}\n\t\t\tspectator.commitBattleResult(battleResult.result);\n\n\t\t\tif (Date.now() - start > maxAcceptableDuration && !hideMaxSimulationDurationWarning) {\n\t\t\t\t// Can happen in case of inifinite boards, or a bug. Don't hog the user's computer in that case\n\t\t\t\tconsole.warn('Stopping simulation after', i, 'iterations and ', Date.now() - start, 'ms');\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\t// Yield intermediate result every 200 iterations\n\t\t\tif (!!intermediateSteps && i > 0 && i % intermediateSteps === 0) {\n\t\t\t\tupdateSimulationResult(simulationResult, inputReady, damageConfidence);\n\t\t\t\tyield simulationResult;\n\t\t\t}\n\t\t}\n\t\tupdateSimulationResult(simulationResult, inputReady, damageConfidence);\n\t\t!battleInput.options?.skipInfoLogs && console.timeEnd('simulation');\n\t\tspectator.prune();\n\t\tsimulationResult.outcomeSamples = spectator.buildOutcomeSamples(battleInput.gameState);\n\t\t// Avoid sending this verbose data\n\n\t\tsimulationResult.damageWons = [];\n\t\tsimulationResult.damageLosts = [];\n\t\t// !battleInput.options?.skipInfoLogs && console.timeEnd('full-sim');\n\t\treturn simulationResult;\n\t} finally {\n\t\tif (battleInput.debugState) {\n\t\t\tdebugState.active = false;\n\t\t}\n\t}\n};\n\nconst updateSimulationResult = (simulationResult: SimulationResult, input: BgsBattleInfo, damageConfidence: number) => {\n\tconst totalMatches = simulationResult.won + simulationResult.tied + simulationResult.lost;\n\tsimulationResult.wonPercent = checkRounding(\n\t\tMath.round((10 * (100 * simulationResult.won)) / totalMatches) / 10,\n\t\tsimulationResult.won,\n\t\ttotalMatches,\n\t);\n\tsimulationResult.wonLethalPercent = checkRounding(\n\t\tMath.round((10 * (100 * simulationResult.wonLethal)) / totalMatches) / 10,\n\t\tsimulationResult.wonLethal,\n\t\ttotalMatches,\n\t);\n\tsimulationResult.lostPercent = checkRounding(\n\t\tMath.round((10 * (100 * simulationResult.lost)) / totalMatches) / 10,\n\t\tsimulationResult.lost,\n\t\ttotalMatches,\n\t);\n\tsimulationResult.lostLethalPercent = checkRounding(\n\t\tMath.round((10 * (100 * simulationResult.lostLethal)) / totalMatches) / 10,\n\t\tsimulationResult.lostLethal,\n\t\ttotalMatches,\n\t);\n\tsimulationResult.tiedPercent = checkRounding(\n\t\tMath.max(0, 100 - simulationResult.lostPercent - simulationResult.wonPercent),\n\t\tsimulationResult.tied,\n\t\ttotalMatches,\n\t);\n\n\t// simulationResult.wonLethalPercent = Math.round((10 * (100 * simulationResult.wonLethal)) / totalMatches) / 10;\n\t// simulationResult.lostLethalPercent = Math.round((10 * (100 * simulationResult.lostLethal)) / totalMatches) / 10;\n\tconst totalDamageWon = simulationResult.damageWons.reduce((a, b) => a + b, 0);\n\tconst totalDamageLost = simulationResult.damageLosts.reduce((a, b) => a + b, 0);\n\tconst damageWonRange = calculateDamageRange(simulationResult.damageWons, damageConfidence);\n\tconst damageLostRange = calculateDamageRange(simulationResult.damageLosts, damageConfidence);\n\tsimulationResult.averageDamageWon = simulationResult.won ? totalDamageWon / simulationResult.won : 0;\n\tsimulationResult.averageDamageLost = simulationResult.lost ? totalDamageLost / simulationResult.lost : 0;\n\tsimulationResult.damageWonRange = simulationResult.won ? damageWonRange : null;\n\tsimulationResult.damageLostRange = simulationResult.lost ? damageLostRange : null;\n\n\tif (\n\t\tsimulationResult.averageDamageWon > 0 &&\n\t\tsimulationResult.averageDamageWon < input.playerBoard.player.tavernTier\n\t) {\n\t\tconsole.warn('average damage won issue');\n\t}\n\tif (\n\t\tsimulationResult.averageDamageLost > 0 &&\n\t\tsimulationResult.averageDamageLost < input.opponentBoard.player.tavernTier\n\t) {\n\t\tconsole.warn('average damage lost issue');\n\t}\n};\n\nconst calculateDamageRange = (damageArray: number[], damageConfidence: number): { min: number; max: number } => {\n\tif (damageArray.length === 0) {\n\t\treturn { min: 0, max: 0 };\n\t}\n\n\t// Sort the array\n\tconst sortedDamage = [...damageArray].sort((a, b) => a - b);\n\n\t// Calculate the 10th and 90th percentiles\n\tconst percentile = (arr: number[], p: number) => {\n\t\tconst index = Math.floor(p * arr.length);\n\t\treturn arr[index];\n\t};\n\n\tconst minDamage = percentile(sortedDamage, 1 - damageConfidence);\n\tconst maxDamage = percentile(sortedDamage, damageConfidence);\n\n\treturn { min: minDamage, max: maxDamage };\n};\n\nconst checkRounding = (roundedValue: number, initialValue: number, totalValue: number): number => {\n\tif (roundedValue === 0 && initialValue !== 0) {\n\t\treturn 0.01;\n\t}\n\tif (roundedValue === 100 && initialValue !== totalValue) {\n\t\treturn 99.9;\n\t}\n\treturn roundedValue;\n};\n\n// Used when triggering random deathrattles\nconst VALID_DEATHRATTLE_ENCHANTMENTS = [\n\tCardIds.ReplicatingMenace_ReplicatingMenaceEnchantment_BG_BOT_312e,\n\tCardIds.ReplicatingMenace_ReplicatingMenaceEnchantment_TB_BaconUps_032e,\n\tCardIds.LivingSpores_LivingSporesEnchantment,\n\tCardIds.Leapfrogger_LeapfrogginEnchantment_BG21_000e,\n\tCardIds.Leapfrogger_LeapfrogginEnchantment_BG21_000_Ge,\n\tCardIds.Sneed_SneedsReplicator,\n\tCardIds.SneedsReplicator_ReplicateEnchantment,\n\tCardIds.EarthRecollectionEnchantment, // Spirit Raptor\n\tCardIds.FireRecollectionEnchantment,\n\tCardIds.LightningRecollectionEnchantment,\n\tCardIds.WaterRecollectionEnchantment,\n\tCardIds.EarthInvocation_ElementEarthEnchantment, // Summon a 1/1\n\tCardIds.LightningInvocation, // Deal 1 damage to 5 enemy minions\n\t// CardIds.SurfNSurf_CrabRidingEnchantment_BG27_004e,\n\t// CardIds.SurfNSurf_CrabRidingEnchantment_BG27_004_Ge,\n\t// CardIds.RecurringNightmare_NightmareInsideEnchantment_BG26_055e,\n\t// CardIds.RecurringNightmare_NightmareInsideEnchantment_BG26_055_Ge,\n\tCardIds.BoonOfBeetles_BeetleSwarmEnchantment_BG28_603e,\n\tCardIds.RustyTrident_TridentsTreasureEnchantment_BG30_MagicItem_917e,\n\tCardIds.HoggyBank_GemInTheBankEnchantment_BG30_MagicItem_411e,\n\tCardIds.JarredFrostling_FrostyGlobeEnchantment_BG30_MagicItem_952e,\n\tCardIds.CaduceusReactor_CaduceusReactorEnchantment_BG31_HERO_801ptee,\n\tCardIds.AutoAssembler_AutoAssemblerEnchantment_BG32_172e,\n\tCardIds.AutoAssembler_AutoAssemblerEnchantment_BG32_172_Ge,\n\tCardIds.TamsinRoame_ImpendingSacrificeEnchantment_BG20_HERO_282e2,\n];\nconst validDeathrattleEnchantmentsFromMapping = [];\nexport const isValidDeathrattleEnchantment = (cardId: string): boolean => {\n\tif (VALID_DEATHRATTLE_ENCHANTMENTS.includes(cardId as CardIds)) {\n\t\treturn true;\n\t}\n\tif (validDeathrattleEnchantmentsFromMapping.length === 0) {\n\t\tfor (const cardImpl of Object.values(cardMappings)) {\n\t\t\t// Also includes non-enchantments, but since we only match this against the enchants list, it's fine\n\t\t\tif (hasDeathrattleSpawnEnchantment(cardImpl)) {\n\t\t\t\tvalidDeathrattleEnchantmentsFromMapping.push(...cardImpl.cardIds);\n\t\t\t}\n\t\t}\n\t}\n\treturn validDeathrattleEnchantmentsFromMapping.includes(cardId);\n};\n\n// const cleanEnchantmentsForEntity = (\n// \tenchantments: { cardId: string; originEntityId?: number; timing: number }[],\n// \tentityIds: readonly number[],\n// ): { cardId: string; originEntityId?: number; timing: number }[] => {\n// \treturn enchantments.filter(\n// \t\t(enchant) =>\n// \t\t\tentityIds.indexOf(enchant.originEntityId) !== -1 ||\n// \t\t\tvalidEnchantments.indexOf(enchant.cardId as CardIds) !== -1,\n// \t);\n// };\n"]}
@@ -96,12 +96,14 @@ const setImplicitDataHero = (hero, cardsData, isPlayer, entityIdContainer) => {
96
96
  avengeDefault: cardsData.avengeValue(reward),
97
97
  scriptDataNum1: cardsData.defaultScriptDataNum(reward),
98
98
  }));
99
- hero.trinkets = ((_e = hero.trinkets) !== null && _e !== void 0 ? _e : []).map((trinket) => ({
99
+ hero.trinkets = ((_e = hero.trinkets) !== null && _e !== void 0 ? _e : [])
100
+ .map((trinket) => ({
100
101
  ...trinket,
101
102
  avengeDefault: cardsData.avengeValue(trinket.cardId),
102
103
  avengeCurrent: cardsData.avengeValue(trinket.cardId),
103
104
  scriptDataNum1: trinket.scriptDataNum1 || cardsData.defaultScriptDataNum(trinket.cardId),
104
- }));
105
+ }))
106
+ .sort((a, b) => a.entityId - b.entityId);
105
107
  hero.entityId = hero.entityId || entityIdContainer.entityId--;
106
108
  hero.hand = (_f = hero.hand) !== null && _f !== void 0 ? _f : [];
107
109
  hero.enchantments = (_g = hero.enchantments) !== null && _g !== void 0 ? _g : [];
@@ -1 +1 @@
1
- {"version":3,"file":"auras.js","sourceRoot":"","sources":["../../src/simulation/auras.ts"],"names":[],"mappings":";;;AACA,iEAAqE;AAIrE,iDAAoD;AAEpD,oCAAgE;AAGzD,MAAM,eAAe,GAAG,CAC9B,KAAoB,EACpB,SAA0B,EAC1B,SAA4B,EAC5B,QAAyB,EAClB,EAAE;IACT,qBAAqB,CAAC,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC;IAC7D,IAAA,+BAAuB,EAAC,KAAK,EAAE,SAAS,CAAC,CAAC;IAC1C,IAAA,6BAAqB,EAAC,KAAK,EAAE,SAAS,CAAC,CAAC;AACzC,CAAC,CAAC;AATW,QAAA,eAAe,mBAS1B;AAEK,MAAM,qBAAqB,GAAG,CAAC,KAAoB,EAAE,SAA0B,EAAQ,EAAE;;IAC/F,KAAK,MAAM,OAAO,IAAI,MAAA,SAAS,CAAC,QAAQ,mCAAI,EAAE,EAAE;KAoB/C;AACF,CAAC,CAAC;AAtBW,QAAA,qBAAqB,yBAsBhC;AAEK,MAAM,uBAAuB,GAAG,CAAC,KAAoB,EAAE,SAA0B,EAAQ,EAAE;IACjG,KAAK,MAAM,SAAS,IAAI,SAAS,CAAC,UAAU,EAAE;QAC7C,IAAI,SAAS,CAAC,MAAM,sBAA0B,EAAE;YAC/C,KAAK;iBACH,MAAM,CACN,CAAC,CAAC,EAAE,EAAE,CACL,CAAC,CAAC,CAAC,YAAY,CAAC,IAAI,CACnB,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,uBAA0D,CAC/E,CACF;iBACA,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE;gBACd,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC;YACf,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AAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC,CAAC;QACjF,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAA,uBAAa,EAAC,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC;KAC3F;AACF,CAAC,CAAC;AAlBW,QAAA,oBAAoB,wBAkB/B","sourcesContent":["/* eslint-disable @typescript-eslint/no-use-before-define */\r\nimport { AllCardsService, 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 { updateStealth } from '../keywords/stealth';\r\nimport { CardIds } from '../services/card-ids';\r\nimport { addImpliedMechanics, hasCorrectTribe } from '../utils';\r\nimport { FullGameState } from './internal-game-state';\r\n\r\nexport const setMissingAuras = (\r\n\tboard: BoardEntity[],\r\n\tboardHero: BgsPlayerEntity,\r\n\tanomalies: readonly string[],\r\n\tallCards: AllCardsService,\r\n): void => {\r\n\tsetMissingMinionsAura(board, boardHero, anomalies, allCards);\r\n\tsetMissingHeroPowerAura(board, boardHero);\r\n\tsetMissingTrinketAura(board, boardHero);\r\n};\r\n\r\nexport const setMissingTrinketAura = (board: BoardEntity[], boardHero: BgsPlayerEntity): void => {\r\n\tfor (const trinket of boardHero.trinkets ?? []) {\r\n\t\t// switch (trinket.cardId) {\r\n\t\t// \tcase CardIds.WindrunnerNecklace_BG30_MagicItem_997:\r\n\t\t// \tcase CardIds.WindrunnerNecklace_WindrunnerNecklaceToken_BG30_MagicItem_997t:\r\n\t\t// \t\tconst enchantment =\r\n\t\t// \t\t\ttrinket.cardId === CardIds.WindrunnerNecklace_BG30_MagicItem_997\r\n\t\t// \t\t\t\t? CardIds.WindrunnerNecklace_RunningLikeTheWindEnchantment_BG30_MagicItem_997e\r\n\t\t// \t\t\t\t: CardIds.WindrunnerNecklace_RunningLikeTheWindEnchantment_BG30_MagicItem_997e2;\r\n\t\t// \t\tconst buff = trinket.cardId === CardIds.WindrunnerNecklace_BG30_MagicItem_997 ? 8 : 20;\r\n\t\t// \t\tconst target = board[0];\r\n\t\t// \t\tif (!!target && !target.enchantments?.find((e) => e.cardId === enchantment)) {\r\n\t\t// \t\t\ttarget.attack += buff;\r\n\t\t// \t\t\ttarget.enchantments.push({\r\n\t\t// \t\t\t\tcardId: enchantment,\r\n\t\t// \t\t\t\toriginEntityId: trinket.entityId,\r\n\t\t// \t\t\t\ttiming: 0,\r\n\t\t// \t\t\t});\r\n\t\t// \t\t}\r\n\t\t// \t\tbreak;\r\n\t\t// }\r\n\t}\r\n};\r\n\r\nexport const setMissingHeroPowerAura = (board: BoardEntity[], boardHero: BgsPlayerEntity): void => {\r\n\tfor (const heroPower of boardHero.heroPowers) {\r\n\t\tif (heroPower.cardId === CardIds.TheSmokingGun) {\r\n\t\t\tboard\r\n\t\t\t\t.filter(\r\n\t\t\t\t\t(e) =>\r\n\t\t\t\t\t\t!e.enchantments.find(\r\n\t\t\t\t\t\t\t(ench) => ench.cardId === CardIds.TheSmokingGun_ArmedAndStillSmokingEnchantment,\r\n\t\t\t\t\t\t),\r\n\t\t\t\t)\r\n\t\t\t\t.forEach((e) => {\r\n\t\t\t\t\te.attack += 4;\r\n\t\t\t\t});\r\n\t\t}\r\n\t\tif (heroPower.cardId === CardIds.VolatileVenom) {\r\n\t\t\tboard\r\n\t\t\t\t.filter(\r\n\t\t\t\t\t(e) => !e.enchantments.find((ench) => ench.cardId === CardIds.VolatileVenom_VolatileEnchantment),\r\n\t\t\t\t)\r\n\t\t\t\t.forEach((e) => {\r\n\t\t\t\t\te.attack += 7;\r\n\t\t\t\t\te.health += 7;\r\n\t\t\t\t\te.enchantments.push({\r\n\t\t\t\t\t\tcardId: CardIds.VolatileVenom_VolatileEnchantment,\r\n\t\t\t\t\t\toriginEntityId: undefined,\r\n\t\t\t\t\t\ttiming: 0,\r\n\t\t\t\t\t});\r\n\t\t\t\t});\r\n\t\t}\r\n\t}\r\n};\r\n\r\nconst setMissingMinionsAura = (\r\n\tboard: BoardEntity[],\r\n\tboardHero: BgsPlayerEntity,\r\n\tanomalies: readonly string[],\r\n\tallCards: AllCardsService,\r\n): void => {\r\n\tsetMissingAura(\r\n\t\tboard.filter((e) => hasCorrectTribe(e, boardHero, Race.PIRATE, anomalies, allCards)),\r\n\t\tCardIds.SouthseaCaptainLegacy_BG_NEW1_027,\r\n\t\tCardIds.SouthseaCaptain_YarrrVanillaEnchantment,\r\n\t\t1,\r\n\t\t1,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tboard.filter((e) => hasCorrectTribe(e, boardHero, Race.PIRATE, anomalies, allCards)),\r\n\t\tCardIds.SouthseaCaptainLegacy_TB_BaconUps_136,\r\n\t\tCardIds.SouthseaCaptain_YarrrEnchantment,\r\n\t\t2,\r\n\t\t2,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tboard.filter((e) => hasCorrectTribe(e, boardHero, Race.MURLOC, anomalies, allCards)),\r\n\t\tCardIds.MurlocWarleaderLegacy_BG_EX1_507,\r\n\t\tCardIds.MurlocWarleader_MrgglaarglLegacyEnchantment,\r\n\t\t2,\r\n\t\t0,\r\n\t);\r\n\t// setMissingAura(\r\n\t// \tboard.filter((e) => hasCorrectTribe(e, boardHero, Race.MURLOC, anomalies, allCards)),\r\n\t// \tCardIds.MurlocWarleaderLegacy_BG_EX1_507,\r\n\t// \tCardIds.MurlocWarleader_MrgglaarglEnchantment,\r\n\t// \t4,\r\n\t// \t0,\r\n\t// );\r\n\t// setMissingAura(\r\n\t// \tboard.filter((e) => hasCorrectTribe(e, boardHero, Race.DEMON, anomalies, allCards)),\r\n\t// \tCardIds.Kathranatir_BG21_039,\r\n\t// \tCardIds.Kathranatir_GraspOfKathranatirEnchantment_BG21_039e,\r\n\t// \t2,\r\n\t// \t0,\r\n\t// );\r\n\t// setMissingAura(\r\n\t// \tboard.filter((e) => hasCorrectTribe(e, boardHero, Race.DEMON, anomalies, allCards)),\r\n\t// \tCardIds.Kathranatir_BG21_039_G,\r\n\t// \tCardIds.Kathranatir_GraspOfKathranatirEnchantment_BG21_039_Ge,\r\n\t// \t4,\r\n\t// \t0,\r\n\t// );\r\n\tsetMissingAura(\r\n\t\tboard.filter((e) => e.divineShield),\r\n\t\tCardIds.CyborgDrake_BG25_043,\r\n\t\tCardIds.CyborgDrake_CyborgEnhancementEnchantment_BG25_043e,\r\n\t\t6,\r\n\t\t0,\r\n\t\tfalse,\r\n\t);\r\n\t// setMissingAura(\r\n\t// \tboard.filter((e) => e.divineShield),\r\n\t// \tCardIds.CyborgDrake_BG25_043_G,\r\n\t// \tCardIds.CyborgDrake_CyborgEnhancementEnchantment_BG25_043_Ge,\r\n\t// \t12,\r\n\t// \t0,\r\n\t// \tfalse,\r\n\t// );\r\n\tsetMissingAura(\r\n\t\tboard.filter((e) => hasCorrectTribe(e, boardHero, Race.UNDEAD, anomalies, allCards)),\r\n\t\tCardIds.SoreLoser_BG27_030,\r\n\t\tCardIds.SoreLoser_NoImWinningEnchantment_BG27_030e,\r\n\t\tboardHero.tavernTier,\r\n\t\t0,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tboard.filter((e) => hasCorrectTribe(e, boardHero, Race.UNDEAD, anomalies, allCards)),\r\n\t\tCardIds.SoreLoser_BG27_030_G,\r\n\t\tCardIds.SoreLoser_NoImWinningEnchantment_BG27_030e,\r\n\t\t2 * boardHero.tavernTier,\r\n\t\t0,\r\n\t);\r\n};\r\n\r\nconst setMissingAura = (\r\n\tboard: BoardEntity[],\r\n\tminionCardId: string,\r\n\tenchantmentCardId: string,\r\n\tattack: number,\r\n\thealth: number,\r\n\tignoreSelf = true,\r\n\tallCards: AllCardsService = null,\r\n): void => {\r\n\tconst buffers = board.filter((e) => e.cardId === minionCardId);\r\n\tfor (const buffer of buffers) {\r\n\t\tboard\r\n\t\t\t.filter((e) => !e.enchantments.find((ench) => ench.cardId === enchantmentCardId))\r\n\t\t\t.filter((e) => (ignoreSelf ? e.entityId !== buffer.entityId : true))\r\n\t\t\t.forEach((e) => {\r\n\t\t\t\te.attack += attack;\r\n\t\t\t\te.health += health;\r\n\t\t\t});\r\n\t}\r\n};\r\n\r\nexport const setImplicitDataHero = (\r\n\thero: BgsPlayerEntity,\r\n\tcardsData: CardsData,\r\n\tisPlayer: boolean,\r\n\tentityIdContainer: { entityId: number },\r\n): void => {\r\n\tfor (const heroPower of hero.heroPowers) {\r\n\t\tconst avengeValue = cardsData.avengeValue(heroPower.cardId);\r\n\t\tif (avengeValue > 0) {\r\n\t\t\theroPower.avengeCurrent = avengeValue - (heroPower.scoreValue2 ?? 0);\r\n\t\t\theroPower.avengeDefault = avengeValue;\r\n\t\t}\r\n\t\tif ((heroPower.info as BoardEntity)?.health) {\r\n\t\t\taddImpliedMechanics(heroPower.info as BoardEntity, cardsData);\r\n\t\t}\r\n\t}\r\n\t// Backward compatibility\r\n\tif (!!hero.questRewards?.length && !Array.isArray(hero.questRewards)) {\r\n\t\thero.questRewards = [hero.questRewards as any];\r\n\t}\r\n\r\n\t// Because Denathrius can send a quest reward as its hero power (I think)\r\n\t// For now deactivating this, until I have a scenario where this matters. It feels like\r\n\t// this should be a display issue only, as quest rewards are also handled in the code\r\n\tconst heroPowerAsReward = null; // hero.cardId === CardIds.SireDenathrius_BG24_HERO_100 ? hero.heroPowers[0]?.cardId : null;\r\n\thero.questRewards = [...(hero.questRewards ?? []), heroPowerAsReward].filter((e) => !!e);\r\n\thero.questRewardEntities = hero.questRewardEntities\r\n\t\t? hero.questRewardEntities.map((reward: any) => ({\r\n\t\t\t\tcardId: reward.CardId,\r\n\t\t\t\tscriptDataNum1: reward.ScriptDataNum1 ?? 0,\r\n\t\t\t\tentityId: entityIdContainer.entityId--,\r\n\t\t\t\tavengeDefault: cardsData.avengeValue(reward.CardId),\r\n\t\t\t\tavengeCurrent: cardsData.avengeValue(reward.CardId),\r\n\t\t }))\r\n\t\t: hero.questRewards.map((reward) => ({\r\n\t\t\t\tcardId: reward,\r\n\t\t\t\tentityId: entityIdContainer.entityId--,\r\n\t\t\t\tavengeCurrent: cardsData.avengeValue(reward),\r\n\t\t\t\tavengeDefault: cardsData.avengeValue(reward),\r\n\t\t\t\tscriptDataNum1: cardsData.defaultScriptDataNum(reward),\r\n\t\t }));\r\n\thero.trinkets = (hero.trinkets ?? []).map((trinket) => ({\r\n\t\t...trinket,\r\n\t\tavengeDefault: cardsData.avengeValue(trinket.cardId),\r\n\t\tavengeCurrent: cardsData.avengeValue(trinket.cardId),\r\n\t\t// Use scriptDataNum1 to keep the info from the input\r\n\t\tscriptDataNum1: trinket.scriptDataNum1 || cardsData.defaultScriptDataNum(trinket.cardId),\r\n\t}));\r\n\t// 0 is not a valid entityId\r\n\thero.entityId = hero.entityId || entityIdContainer.entityId--;\r\n\thero.hand = hero.hand ?? [];\r\n\thero.enchantments = hero.enchantments ?? [];\r\n\tif (!hero.globalInfo) {\r\n\t\thero.globalInfo = {};\r\n\t}\r\n\r\n\thero.globalInfo.EternalKnightsDeadThisGame = hero.globalInfo.EternalKnightsDeadThisGame ?? 0;\r\n\thero.globalInfo.SanlaynScribesDeadThisGame = hero.globalInfo.SanlaynScribesDeadThisGame ?? 0;\r\n\thero.globalInfo.BeastsSummonedThisGame = hero.globalInfo.BeastsSummonedThisGame ?? 0;\r\n\thero.globalInfo.BeastsSummonedThisCombat = hero.globalInfo.BeastsSummonedThisCombat ?? 0;\r\n\thero.globalInfo.MagnetizedThisGame = hero.globalInfo.MagnetizedThisGame ?? 0;\r\n\thero.globalInfo.PiratesSummonedThisGame = hero.globalInfo.PiratesSummonedThisGame ?? 0;\r\n\thero.globalInfo.BattlecriesTriggeredThisGame = hero.globalInfo.BattlecriesTriggeredThisGame ?? 0;\r\n\thero.globalInfo.DeathrattlesTriggeredThisGame = hero.globalInfo.DeathrattlesTriggeredThisGame ?? 0;\r\n\thero.globalInfo.BeetleAttackBuff = hero.globalInfo.BeetleAttackBuff ?? 0;\r\n\thero.globalInfo.BeetleHealthBuff = hero.globalInfo.BeetleHealthBuff ?? 0;\r\n\thero.globalInfo.ElementalAttackBuff = hero.globalInfo.ElementalAttackBuff ?? 0;\r\n\thero.globalInfo.ElementalHealthBuff = hero.globalInfo.ElementalHealthBuff ?? 0;\r\n\thero.globalInfo.PirateAttackBuff = hero.globalInfo.PirateAttackBuff ?? 0;\r\n\thero.globalInfo.PirateHealthBuff = hero.globalInfo.PirateHealthBuff ?? 0;\r\n\thero.globalInfo.TavernSpellAttackBuff = hero.globalInfo.TavernSpellAttackBuff ?? 0;\r\n\thero.globalInfo.TavernSpellHealthBuff = hero.globalInfo.TavernSpellHealthBuff ?? 0;\r\n\thero.globalInfo.MutatedLasherAttackBuff = hero.globalInfo.MutatedLasherAttackBuff ?? 0;\r\n\thero.globalInfo.MutatedLasherHealthBuff = hero.globalInfo.MutatedLasherHealthBuff ?? 0;\r\n\thero.globalInfo.TavernSpellsCastThisGame = hero.globalInfo.TavernSpellsCastThisGame ?? 0;\r\n\thero.globalInfo.TavernSpellsCastThisTurn = hero.globalInfo.TavernSpellsCastThisTurn ?? 0;\r\n\thero.globalInfo.CardsPlayedThisTurn = hero.globalInfo.CardsPlayedThisTurn ?? 0;\r\n\thero.globalInfo.MrrgltonsPlayedThisGame = hero.globalInfo.MrrgltonsPlayedThisGame ?? 0;\r\n\thero.globalInfo.AdditionalAttack = hero.globalInfo.AdditionalAttack ?? 0;\r\n\thero.globalInfo.SpellsCastThisGame = hero.globalInfo.SpellsCastThisGame ?? 0;\r\n\thero.globalInfo.UndeadAttackBonus = hero.globalInfo.UndeadAttackBonus ?? 0;\r\n\thero.globalInfo.UndeadHealthBonus = hero.globalInfo.UndeadHealthBonus ?? 0;\r\n\thero.globalInfo.HauntedCarapaceAttackBonus = hero.globalInfo.HauntedCarapaceAttackBonus ?? 0;\r\n\thero.globalInfo.HauntedCarapaceHealthBonus = hero.globalInfo.HauntedCarapaceHealthBonus ?? 0;\r\n\thero.globalInfo.FrostlingBonus = hero.globalInfo.FrostlingBonus ?? 0;\r\n\thero.globalInfo.BloodGemAttackBonus =\r\n\t\t(hero.globalInfo.BloodGemAttackBonus ?? 0) +\r\n\t\t// Not sure why, but this isn't reflected in the player enchant\r\n\t\t(hero.questRewardEntities?.filter((e) => e.cardId === CardIds.EndlessBloodMoon).length ?? 0);\r\n\thero.globalInfo.BloodGemHealthBonus =\r\n\t\t(hero.globalInfo.BloodGemHealthBonus ?? 0) +\r\n\t\t(hero.questRewardEntities?.filter((e) => e.cardId === CardIds.EndlessBloodMoon).length ?? 0);\r\n\thero.globalInfo.GoldrinnBuffAtk = hero.globalInfo.GoldrinnBuffAtk ?? 0;\r\n\thero.globalInfo.GoldrinnBuffHealth = hero.globalInfo.GoldrinnBuffHealth ?? 0;\r\n\thero.globalInfo.WhelpAttackBuff = hero.globalInfo.WhelpAttackBuff ?? 0;\r\n\thero.globalInfo.WhelpHealthBuff = hero.globalInfo.WhelpHealthBuff ?? 0;\r\n\thero.globalInfo.GoldSpentThisGame = hero.globalInfo.GoldSpentThisGame ?? 0;\r\n\thero.globalInfo.VolumizerAttackBuff = hero.globalInfo.VolumizerAttackBuff ?? 0;\r\n\thero.globalInfo.VolumizerHealthBuff = hero.globalInfo.VolumizerHealthBuff ?? 0;\r\n\thero.globalInfo.DeepBluesPlayed = hero.globalInfo.DeepBluesPlayed ?? 0;\r\n\thero.globalInfo.DeathrattlesTriggeredThisGame = hero.globalInfo.DeathrattlesTriggeredThisGame ?? 0;\r\n\thero.globalInfo.BackToBackCastThisGame = hero.globalInfo.BackToBackCastThisGame ?? 0;\r\n\thero.globalInfo.TavernSpellsCastThisTurn = hero.globalInfo.TavernSpellsCastThisTurn ?? 0;\r\n\thero.globalInfo.CardsPlayedThisTurn = hero.globalInfo.CardsPlayedThisTurn ?? 0;\r\n\thero.globalInfo.MrrgltonsPlayedThisGame = hero.globalInfo.MrrgltonsPlayedThisGame ?? 0;\r\n};\r\n\r\nexport const clearStealthIfNeeded = (\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\t// https://twitter.com/DCalkosz/status/1562194944688660481?s=20&t=100I8IVZmBKgYQWkdK8nIA\r\n\tif (board.every((entity) => entity.stealth && !entity.attack)) {\r\n\t\tboard.forEach((e) => updateStealth(e, false, board, hero, otherHero, gameState));\r\n\t}\r\n\tif (otherBoard.every((entity) => entity.stealth && !entity.attack)) {\r\n\t\totherBoard.forEach((e) => updateStealth(e, false, otherBoard, otherHero, hero, gameState));\r\n\t}\r\n\tif (board.every((e) => e.stealth) && otherBoard.every((e) => e.stealth)) {\r\n\t\tboard.forEach((e) => updateStealth(e, false, board, hero, otherHero, gameState));\r\n\t\totherBoard.forEach((e) => updateStealth(e, false, otherBoard, otherHero, hero, gameState));\r\n\t}\r\n};\r\n"]}
1
+ {"version":3,"file":"auras.js","sourceRoot":"","sources":["../../src/simulation/auras.ts"],"names":[],"mappings":";;;AACA,iEAAqE;AAIrE,iDAAoD;AAEpD,oCAAgE;AAGzD,MAAM,eAAe,GAAG,CAC9B,KAAoB,EACpB,SAA0B,EAC1B,SAA4B,EAC5B,QAAyB,EAClB,EAAE;IACT,qBAAqB,CAAC,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC;IAC7D,IAAA,+BAAuB,EAAC,KAAK,EAAE,SAAS,CAAC,CAAC;IAC1C,IAAA,6BAAqB,EAAC,KAAK,EAAE,SAAS,CAAC,CAAC;AACzC,CAAC,CAAC;AATW,QAAA,eAAe,mBAS1B;AAEK,MAAM,qBAAqB,GAAG,CAAC,KAAoB,EAAE,SAA0B,EAAQ,EAAE;;IAC/F,KAAK,MAAM,OAAO,IAAI,MAAA,SAAS,CAAC,QAAQ,mCAAI,EAAE,EAAE;KAoB/C;AACF,CAAC,CAAC;AAtB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ACD,IAAI,UAAU,CAAC,KAAK,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE;QACnE,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAA,uBAAa,EAAC,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC;KAC3F;IACD,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE;QACxE,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAA,uBAAa,EAAC,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC,CAAC;QACjF,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAA,uBAAa,EAAC,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC;KAC3F;AACF,CAAC,CAAC;AAlBW,QAAA,oBAAoB,wBAkB/B","sourcesContent":["/* eslint-disable @typescript-eslint/no-use-before-define */\r\nimport { AllCardsService, 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 { updateStealth } from '../keywords/stealth';\r\nimport { CardIds } from '../services/card-ids';\r\nimport { addImpliedMechanics, hasCorrectTribe } from '../utils';\r\nimport { FullGameState } from './internal-game-state';\r\n\r\nexport const setMissingAuras = (\r\n\tboard: BoardEntity[],\r\n\tboardHero: BgsPlayerEntity,\r\n\tanomalies: readonly string[],\r\n\tallCards: AllCardsService,\r\n): void => {\r\n\tsetMissingMinionsAura(board, boardHero, anomalies, allCards);\r\n\tsetMissingHeroPowerAura(board, boardHero);\r\n\tsetMissingTrinketAura(board, boardHero);\r\n};\r\n\r\nexport const setMissingTrinketAura = (board: BoardEntity[], boardHero: BgsPlayerEntity): void => {\r\n\tfor (const trinket of boardHero.trinkets ?? []) {\r\n\t\t// switch (trinket.cardId) {\r\n\t\t// \tcase CardIds.WindrunnerNecklace_BG30_MagicItem_997:\r\n\t\t// \tcase CardIds.WindrunnerNecklace_WindrunnerNecklaceToken_BG30_MagicItem_997t:\r\n\t\t// \t\tconst enchantment =\r\n\t\t// \t\t\ttrinket.cardId === CardIds.WindrunnerNecklace_BG30_MagicItem_997\r\n\t\t// \t\t\t\t? CardIds.WindrunnerNecklace_RunningLikeTheWindEnchantment_BG30_MagicItem_997e\r\n\t\t// \t\t\t\t: CardIds.WindrunnerNecklace_RunningLikeTheWindEnchantment_BG30_MagicItem_997e2;\r\n\t\t// \t\tconst buff = trinket.cardId === CardIds.WindrunnerNecklace_BG30_MagicItem_997 ? 8 : 20;\r\n\t\t// \t\tconst target = board[0];\r\n\t\t// \t\tif (!!target && !target.enchantments?.find((e) => e.cardId === enchantment)) {\r\n\t\t// \t\t\ttarget.attack += buff;\r\n\t\t// \t\t\ttarget.enchantments.push({\r\n\t\t// \t\t\t\tcardId: enchantment,\r\n\t\t// \t\t\t\toriginEntityId: trinket.entityId,\r\n\t\t// \t\t\t\ttiming: 0,\r\n\t\t// \t\t\t});\r\n\t\t// \t\t}\r\n\t\t// \t\tbreak;\r\n\t\t// }\r\n\t}\r\n};\r\n\r\nexport const setMissingHeroPowerAura = (board: BoardEntity[], boardHero: BgsPlayerEntity): void => {\r\n\tfor (const heroPower of boardHero.heroPowers) {\r\n\t\tif (heroPower.cardId === CardIds.TheSmokingGun) {\r\n\t\t\tboard\r\n\t\t\t\t.filter(\r\n\t\t\t\t\t(e) =>\r\n\t\t\t\t\t\t!e.enchantments.find(\r\n\t\t\t\t\t\t\t(ench) => ench.cardId === CardIds.TheSmokingGun_ArmedAndStillSmokingEnchantment,\r\n\t\t\t\t\t\t),\r\n\t\t\t\t)\r\n\t\t\t\t.forEach((e) => {\r\n\t\t\t\t\te.attack += 4;\r\n\t\t\t\t});\r\n\t\t}\r\n\t\tif (heroPower.cardId === CardIds.VolatileVenom) {\r\n\t\t\tboard\r\n\t\t\t\t.filter(\r\n\t\t\t\t\t(e) => !e.enchantments.find((ench) => ench.cardId === CardIds.VolatileVenom_VolatileEnchantment),\r\n\t\t\t\t)\r\n\t\t\t\t.forEach((e) => {\r\n\t\t\t\t\te.attack += 7;\r\n\t\t\t\t\te.health += 7;\r\n\t\t\t\t\te.enchantments.push({\r\n\t\t\t\t\t\tcardId: CardIds.VolatileVenom_VolatileEnchantment,\r\n\t\t\t\t\t\toriginEntityId: undefined,\r\n\t\t\t\t\t\ttiming: 0,\r\n\t\t\t\t\t});\r\n\t\t\t\t});\r\n\t\t}\r\n\t}\r\n};\r\n\r\nconst setMissingMinionsAura = (\r\n\tboard: BoardEntity[],\r\n\tboardHero: BgsPlayerEntity,\r\n\tanomalies: readonly string[],\r\n\tallCards: AllCardsService,\r\n): void => {\r\n\tsetMissingAura(\r\n\t\tboard.filter((e) => hasCorrectTribe(e, boardHero, Race.PIRATE, anomalies, allCards)),\r\n\t\tCardIds.SouthseaCaptainLegacy_BG_NEW1_027,\r\n\t\tCardIds.SouthseaCaptain_YarrrVanillaEnchantment,\r\n\t\t1,\r\n\t\t1,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tboard.filter((e) => hasCorrectTribe(e, boardHero, Race.PIRATE, anomalies, allCards)),\r\n\t\tCardIds.SouthseaCaptainLegacy_TB_BaconUps_136,\r\n\t\tCardIds.SouthseaCaptain_YarrrEnchantment,\r\n\t\t2,\r\n\t\t2,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tboard.filter((e) => hasCorrectTribe(e, boardHero, Race.MURLOC, anomalies, allCards)),\r\n\t\tCardIds.MurlocWarleaderLegacy_BG_EX1_507,\r\n\t\tCardIds.MurlocWarleader_MrgglaarglLegacyEnchantment,\r\n\t\t2,\r\n\t\t0,\r\n\t);\r\n\t// setMissingAura(\r\n\t// \tboard.filter((e) => hasCorrectTribe(e, boardHero, Race.MURLOC, anomalies, allCards)),\r\n\t// \tCardIds.MurlocWarleaderLegacy_BG_EX1_507,\r\n\t// \tCardIds.MurlocWarleader_MrgglaarglEnchantment,\r\n\t// \t4,\r\n\t// \t0,\r\n\t// );\r\n\t// setMissingAura(\r\n\t// \tboard.filter((e) => hasCorrectTribe(e, boardHero, Race.DEMON, anomalies, allCards)),\r\n\t// \tCardIds.Kathranatir_BG21_039,\r\n\t// \tCardIds.Kathranatir_GraspOfKathranatirEnchantment_BG21_039e,\r\n\t// \t2,\r\n\t// \t0,\r\n\t// );\r\n\t// setMissingAura(\r\n\t// \tboard.filter((e) => hasCorrectTribe(e, boardHero, Race.DEMON, anomalies, allCards)),\r\n\t// \tCardIds.Kathranatir_BG21_039_G,\r\n\t// \tCardIds.Kathranatir_GraspOfKathranatirEnchantment_BG21_039_Ge,\r\n\t// \t4,\r\n\t// \t0,\r\n\t// );\r\n\tsetMissingAura(\r\n\t\tboard.filter((e) => e.divineShield),\r\n\t\tCardIds.CyborgDrake_BG25_043,\r\n\t\tCardIds.CyborgDrake_CyborgEnhancementEnchantment_BG25_043e,\r\n\t\t6,\r\n\t\t0,\r\n\t\tfalse,\r\n\t);\r\n\t// setMissingAura(\r\n\t// \tboard.filter((e) => e.divineShield),\r\n\t// \tCardIds.CyborgDrake_BG25_043_G,\r\n\t// \tCardIds.CyborgDrake_CyborgEnhancementEnchantment_BG25_043_Ge,\r\n\t// \t12,\r\n\t// \t0,\r\n\t// \tfalse,\r\n\t// );\r\n\tsetMissingAura(\r\n\t\tboard.filter((e) => hasCorrectTribe(e, boardHero, Race.UNDEAD, anomalies, allCards)),\r\n\t\tCardIds.SoreLoser_BG27_030,\r\n\t\tCardIds.SoreLoser_NoImWinningEnchantment_BG27_030e,\r\n\t\tboardHero.tavernTier,\r\n\t\t0,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tboard.filter((e) => hasCorrectTribe(e, boardHero, Race.UNDEAD, anomalies, allCards)),\r\n\t\tCardIds.SoreLoser_BG27_030_G,\r\n\t\tCardIds.SoreLoser_NoImWinningEnchantment_BG27_030e,\r\n\t\t2 * boardHero.tavernTier,\r\n\t\t0,\r\n\t);\r\n};\r\n\r\nconst setMissingAura = (\r\n\tboard: BoardEntity[],\r\n\tminionCardId: string,\r\n\tenchantmentCardId: string,\r\n\tattack: number,\r\n\thealth: number,\r\n\tignoreSelf = true,\r\n\tallCards: AllCardsService = null,\r\n): void => {\r\n\tconst buffers = board.filter((e) => e.cardId === minionCardId);\r\n\tfor (const buffer of buffers) {\r\n\t\tboard\r\n\t\t\t.filter((e) => !e.enchantments.find((ench) => ench.cardId === enchantmentCardId))\r\n\t\t\t.filter((e) => (ignoreSelf ? e.entityId !== buffer.entityId : true))\r\n\t\t\t.forEach((e) => {\r\n\t\t\t\te.attack += attack;\r\n\t\t\t\te.health += health;\r\n\t\t\t});\r\n\t}\r\n};\r\n\r\nexport const setImplicitDataHero = (\r\n\thero: BgsPlayerEntity,\r\n\tcardsData: CardsData,\r\n\tisPlayer: boolean,\r\n\tentityIdContainer: { entityId: number },\r\n): void => {\r\n\tfor (const heroPower of hero.heroPowers) {\r\n\t\tconst avengeValue = cardsData.avengeValue(heroPower.cardId);\r\n\t\tif (avengeValue > 0) {\r\n\t\t\theroPower.avengeCurrent = avengeValue - (heroPower.scoreValue2 ?? 0);\r\n\t\t\theroPower.avengeDefault = avengeValue;\r\n\t\t}\r\n\t\tif ((heroPower.info as BoardEntity)?.health) {\r\n\t\t\taddImpliedMechanics(heroPower.info as BoardEntity, cardsData);\r\n\t\t}\r\n\t}\r\n\t// Backward compatibility\r\n\tif (!!hero.questRewards?.length && !Array.isArray(hero.questRewards)) {\r\n\t\thero.questRewards = [hero.questRewards as any];\r\n\t}\r\n\r\n\t// Because Denathrius can send a quest reward as its hero power (I think)\r\n\t// For now deactivating this, until I have a scenario where this matters. It feels like\r\n\t// this should be a display issue only, as quest rewards are also handled in the code\r\n\tconst heroPowerAsReward = null; // hero.cardId === CardIds.SireDenathrius_BG24_HERO_100 ? hero.heroPowers[0]?.cardId : null;\r\n\thero.questRewards = [...(hero.questRewards ?? []), heroPowerAsReward].filter((e) => !!e);\r\n\thero.questRewardEntities = hero.questRewardEntities\r\n\t\t? hero.questRewardEntities.map((reward: any) => ({\r\n\t\t\t\tcardId: reward.CardId,\r\n\t\t\t\tscriptDataNum1: reward.ScriptDataNum1 ?? 0,\r\n\t\t\t\tentityId: entityIdContainer.entityId--,\r\n\t\t\t\tavengeDefault: cardsData.avengeValue(reward.CardId),\r\n\t\t\t\tavengeCurrent: cardsData.avengeValue(reward.CardId),\r\n\t\t }))\r\n\t\t: hero.questRewards.map((reward) => ({\r\n\t\t\t\tcardId: reward,\r\n\t\t\t\tentityId: entityIdContainer.entityId--,\r\n\t\t\t\tavengeCurrent: cardsData.avengeValue(reward),\r\n\t\t\t\tavengeDefault: cardsData.avengeValue(reward),\r\n\t\t\t\tscriptDataNum1: cardsData.defaultScriptDataNum(reward),\r\n\t\t }));\r\n\thero.trinkets = (hero.trinkets ?? [])\r\n\t\t.map((trinket) => ({\r\n\t\t\t...trinket,\r\n\t\t\tavengeDefault: cardsData.avengeValue(trinket.cardId),\r\n\t\t\tavengeCurrent: cardsData.avengeValue(trinket.cardId),\r\n\t\t\t// Use scriptDataNum1 to keep the info from the input\r\n\t\t\tscriptDataNum1: trinket.scriptDataNum1 || cardsData.defaultScriptDataNum(trinket.cardId),\r\n\t\t}))\r\n\t\t.sort((a, b) => a.entityId - b.entityId);\r\n\t// 0 is not a valid entityId\r\n\thero.entityId = hero.entityId || entityIdContainer.entityId--;\r\n\thero.hand = hero.hand ?? [];\r\n\thero.enchantments = hero.enchantments ?? [];\r\n\tif (!hero.globalInfo) {\r\n\t\thero.globalInfo = {};\r\n\t}\r\n\r\n\thero.globalInfo.EternalKnightsDeadThisGame = hero.globalInfo.EternalKnightsDeadThisGame ?? 0;\r\n\thero.globalInfo.SanlaynScribesDeadThisGame = hero.globalInfo.SanlaynScribesDeadThisGame ?? 0;\r\n\thero.globalInfo.BeastsSummonedThisGame = hero.globalInfo.BeastsSummonedThisGame ?? 0;\r\n\thero.globalInfo.BeastsSummonedThisCombat = hero.globalInfo.BeastsSummonedThisCombat ?? 0;\r\n\thero.globalInfo.MagnetizedThisGame = hero.globalInfo.MagnetizedThisGame ?? 0;\r\n\thero.globalInfo.PiratesSummonedThisGame = hero.globalInfo.PiratesSummonedThisGame ?? 0;\r\n\thero.globalInfo.BattlecriesTriggeredThisGame = hero.globalInfo.BattlecriesTriggeredThisGame ?? 0;\r\n\thero.globalInfo.DeathrattlesTriggeredThisGame = hero.globalInfo.DeathrattlesTriggeredThisGame ?? 0;\r\n\thero.globalInfo.BeetleAttackBuff = hero.globalInfo.BeetleAttackBuff ?? 0;\r\n\thero.globalInfo.BeetleHealthBuff = hero.globalInfo.BeetleHealthBuff ?? 0;\r\n\thero.globalInfo.ElementalAttackBuff = hero.globalInfo.ElementalAttackBuff ?? 0;\r\n\thero.globalInfo.ElementalHealthBuff = hero.globalInfo.ElementalHealthBuff ?? 0;\r\n\thero.globalInfo.PirateAttackBuff = hero.globalInfo.PirateAttackBuff ?? 0;\r\n\thero.globalInfo.PirateHealthBuff = hero.globalInfo.PirateHealthBuff ?? 0;\r\n\thero.globalInfo.TavernSpellAttackBuff = hero.globalInfo.TavernSpellAttackBuff ?? 0;\r\n\thero.globalInfo.TavernSpellHealthBuff = hero.globalInfo.TavernSpellHealthBuff ?? 0;\r\n\thero.globalInfo.MutatedLasherAttackBuff = hero.globalInfo.MutatedLasherAttackBuff ?? 0;\r\n\thero.globalInfo.MutatedLasherHealthBuff = hero.globalInfo.MutatedLasherHealthBuff ?? 0;\r\n\thero.globalInfo.TavernSpellsCastThisGame = hero.globalInfo.TavernSpellsCastThisGame ?? 0;\r\n\thero.globalInfo.TavernSpellsCastThisTurn = hero.globalInfo.TavernSpellsCastThisTurn ?? 0;\r\n\thero.globalInfo.CardsPlayedThisTurn = hero.globalInfo.CardsPlayedThisTurn ?? 0;\r\n\thero.globalInfo.MrrgltonsPlayedThisGame = hero.globalInfo.MrrgltonsPlayedThisGame ?? 0;\r\n\thero.globalInfo.AdditionalAttack = hero.globalInfo.AdditionalAttack ?? 0;\r\n\thero.globalInfo.SpellsCastThisGame = hero.globalInfo.SpellsCastThisGame ?? 0;\r\n\thero.globalInfo.UndeadAttackBonus = hero.globalInfo.UndeadAttackBonus ?? 0;\r\n\thero.globalInfo.UndeadHealthBonus = hero.globalInfo.UndeadHealthBonus ?? 0;\r\n\thero.globalInfo.HauntedCarapaceAttackBonus = hero.globalInfo.HauntedCarapaceAttackBonus ?? 0;\r\n\thero.globalInfo.HauntedCarapaceHealthBonus = hero.globalInfo.HauntedCarapaceHealthBonus ?? 0;\r\n\thero.globalInfo.FrostlingBonus = hero.globalInfo.FrostlingBonus ?? 0;\r\n\thero.globalInfo.BloodGemAttackBonus =\r\n\t\t(hero.globalInfo.BloodGemAttackBonus ?? 0) +\r\n\t\t// Not sure why, but this isn't reflected in the player enchant\r\n\t\t(hero.questRewardEntities?.filter((e) => e.cardId === CardIds.EndlessBloodMoon).length ?? 0);\r\n\thero.globalInfo.BloodGemHealthBonus =\r\n\t\t(hero.globalInfo.BloodGemHealthBonus ?? 0) +\r\n\t\t(hero.questRewardEntities?.filter((e) => e.cardId === CardIds.EndlessBloodMoon).length ?? 0);\r\n\thero.globalInfo.GoldrinnBuffAtk = hero.globalInfo.GoldrinnBuffAtk ?? 0;\r\n\thero.globalInfo.GoldrinnBuffHealth = hero.globalInfo.GoldrinnBuffHealth ?? 0;\r\n\thero.globalInfo.WhelpAttackBuff = hero.globalInfo.WhelpAttackBuff ?? 0;\r\n\thero.globalInfo.WhelpHealthBuff = hero.globalInfo.WhelpHealthBuff ?? 0;\r\n\thero.globalInfo.GoldSpentThisGame = hero.globalInfo.GoldSpentThisGame ?? 0;\r\n\thero.globalInfo.VolumizerAttackBuff = hero.globalInfo.VolumizerAttackBuff ?? 0;\r\n\thero.globalInfo.VolumizerHealthBuff = hero.globalInfo.VolumizerHealthBuff ?? 0;\r\n\thero.globalInfo.DeepBluesPlayed = hero.globalInfo.DeepBluesPlayed ?? 0;\r\n\thero.globalInfo.DeathrattlesTriggeredThisGame = hero.globalInfo.DeathrattlesTriggeredThisGame ?? 0;\r\n\thero.globalInfo.BackToBackCastThisGame = hero.globalInfo.BackToBackCastThisGame ?? 0;\r\n\thero.globalInfo.TavernSpellsCastThisTurn = hero.globalInfo.TavernSpellsCastThisTurn ?? 0;\r\n\thero.globalInfo.CardsPlayedThisTurn = hero.globalInfo.CardsPlayedThisTurn ?? 0;\r\n\thero.globalInfo.MrrgltonsPlayedThisGame = hero.globalInfo.MrrgltonsPlayedThisGame ?? 0;\r\n};\r\n\r\nexport const clearStealthIfNeeded = (\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\t// https://twitter.com/DCalkosz/status/1562194944688660481?s=20&t=100I8IVZmBKgYQWkdK8nIA\r\n\tif (board.every((entity) => entity.stealth && !entity.attack)) {\r\n\t\tboard.forEach((e) => updateStealth(e, false, board, hero, otherHero, gameState));\r\n\t}\r\n\tif (otherBoard.every((entity) => entity.stealth && !entity.attack)) {\r\n\t\totherBoard.forEach((e) => updateStealth(e, false, otherBoard, otherHero, hero, gameState));\r\n\t}\r\n\tif (board.every((e) => e.stealth) && otherBoard.every((e) => e.stealth)) {\r\n\t\tboard.forEach((e) => updateStealth(e, false, board, hero, otherHero, gameState));\r\n\t\totherBoard.forEach((e) => updateStealth(e, false, otherBoard, otherHero, hero, gameState));\r\n\t}\r\n};\r\n"]}
@@ -89,6 +89,10 @@ const handleAvenge = (boardWithDeadEntity, boardWithDeadEntityHero, deadEntity,
89
89
  gameState,
90
90
  });
91
91
  if (Array.isArray(newSpawns) && (newSpawns === null || newSpawns === void 0 ? void 0 : newSpawns.length)) {
92
+ const avengeMinionIndexFromRight = boardWithDeadEntity.length - (boardWithDeadEntity.indexOf(avenger) + 1);
93
+ newSpawns.forEach((e) => {
94
+ e.spawnIndexFromRight = avengeMinionIndexFromRight;
95
+ });
92
96
  candidatesEntitiesSpawnedFromAvenge.push(...newSpawns);
93
97
  }
94
98
  }
@@ -1 +1 @@
1
- {"version":3,"file":"avenge.js","sourceRoot":"","sources":["../../src/simulation/avenge.ts"],"names":[],"mappings":";;;AAAA,iEAA6D;AAG7D,4DAAoD;AACpD,iEAA4D;AAC5D,6DAAoE;AACpE,+CAAkD;AAClD,6CAAgD;AAEhD,6CAA+C;AAC/C,gEAAuE;AACvE,oCAMkB;AAClB,qCAA8C;AAC9C,mDAAiD;AACjD,6DAAqD;AAErD,qCAA+C;AAC/C,mCAAsC;AAE/B,MAAM,kBAAkB,GAAG,CACjC,UAAuB,EACvB,wBAAgC,EAChC,mBAAkC,EAClC,uBAAwC,EACxC,UAAyB,EACzB,cAA+B,EAC/B,SAAwB,EACxB,8BAA6C,EAC7B,EAAE;IAClB,MAAM,mCAAmC,GAAkB,EAAE,CAAC;IAE9D,MAAM,QAAQ,GAAG,mBAAmB;SAClC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,aAAa,IAAI,CAAC,CAAC,aAAa,IAAI,CAAC,CAAC;SAGxD,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;QAOd,OAAO,CAAC,CAAC;IACV,CAAC,CAAC,CAAC;IACJ,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE;QAC/B,YAAY,CACX,mBAAmB,EACnB,uBAAuB,EACvB,UAAU,EACV,wBAAwB,EACxB,OAAO,EACP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AA,kCAAa,oBAEtC,CAAC,EACD,mBAAmB,EACnB,uBAAuB,EACvB,UAAU,EACV,cAAc,EACd,SAAS,EACT,UAAU,CAAC,QAAQ,EACnB,KAAK,EACL,KAAK,EACL,KAAK,CACL,CAAC;YACF,iBAAiB,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE;gBACnC,KAAK,CAAC,MAAM,GAAG,CAAC,SAAS,CAAC,IAAI,CAAC;gBAC/B,KAAK,CAAC,MAAM,GAAG,CAAC,SAAS,CAAC,IAAI,CAAC;gBAC/B,KAAK,CAAC,SAAS,GAAG,CAAC,SAAS,CAAC,IAAI,CAAC;gBAClC,KAAK,CAAC,SAAS,GAAG,CAAC,SAAS,CAAC,IAAI,CAAC;YACnC,CAAC,CAAC,CAAC;YACH,SAAS,CAAC,IAAI,GAAG,CAAC,SAAS,CAAC,IAAI,GAAG,CAAC,CAAC;YACrC,mCAAmC,CAAC,IAAI,CAAC,GAAG,iBAAiB,CAAC,CAAC;YAC/D,MAAM;KACP;IACD,SAAS,CAAC,aAAa,IAAI,SAAS,CAAC,aAAa,CAAC;AACpD,CAAC,CAAC","sourcesContent":["import { GameTag, Race } from '@firestone-hs/reference-data';\nimport { BgsHeroPower, BgsPlayerEntity } from '../bgs-player-entity';\nimport { BoardEntity } from '../board-entity';\nimport { hasAvenge } from '../cards/card.interface';\nimport { cardMappings } from '../cards/impl/_card-mappings';\nimport { grantRandomDivineShield } from '../keywords/divine-shield';\nimport { updateReborn } from '../keywords/reborn';\nimport { updateTaunt } from '../keywords/taunt';\nimport { CardIds } from '../services/card-ids';\nimport { pickRandom } from '../services/utils';\nimport { isValidDeathrattleEnchantment } from '../simulate-bgs-battle';\nimport {\n\taddStatsToBoard,\n\tgetRandomMinionWithHighestHealth,\n\tgrantRandomStats,\n\thasCorrectTribe,\n\thasEntityMechanic,\n} from '../utils';\nimport { dealDamageToMinion } from './attack';\nimport { addCardsInHand } from './cards-in-hand';\nimport { spawnEntities } from './deathrattle-spawns';\nimport { FullGameState } from './internal-game-state';\nimport { performEntitySpawns } from './spawns';\nimport { modifyStats } from './stats';\n\nexport const applyAvengeEffects = (\n\tdeadEntity: BoardEntity,\n\tdeadEntityIndexFromRight: number,\n\tboardWithDeadEntity: BoardEntity[],\n\tboardWithDeadEntityHero: BgsPlayerEntity,\n\totherBoard: BoardEntity[],\n\totherBoardHero: BgsPlayerEntity,\n\tgameState: FullGameState,\n\tentitiesSpawnedFromMinionDeath: BoardEntity[],\n): BoardEntity[] => {\n\tconst candidatesEntitiesSpawnedFromAvenge: BoardEntity[] = [];\n\t// updateAvengeCounters(boardWithDeadEntity, boardWithDeadEntityHero);\n\tconst avengers = boardWithDeadEntity\n\t\t.filter((e) => !!e.avengeDefault && e.avengeCurrent <= 0)\n\t\t// Get Tony to be processed first, because of the \"when turned golden, the minion ignores the death for the avenge counter\"\n\t\t// behavior\n\t\t.sort((a, b) => {\n\t\t\t// if (a.cardId === CardIds.TonyTwoTusk_BG21_031 || a.cardId === CardIds.TonyTwoTusk_BG21_031_G) {\n\t\t\t// \treturn -1;\n\t\t\t// }\n\t\t\t// if (b.cardId === CardIds.TonyTwoTusk_BG21_031 || b.cardId === CardIds.TonyTwoTusk_BG21_031_G) {\n\t\t\t// \treturn 1;\n\t\t\t// }\n\t\t\treturn 0;\n\t\t});\n\tfor (const avenger of avengers) {\n\t\thandleAvenge(\n\t\t\tboardWithDeadEntity,\n\t\t\tboardWithDeadEntityHero,\n\t\t\tdeadEntity,\n\t\t\tdeadEntityIndexFromRight,\n\t\t\tavenger,\n\t\t\tcandidatesEntitiesSpawnedFromAvenge,\n\t\t\totherBoard,\n\t\t\totherBoardHero,\n\t\t\tgameState,\n\t\t);\n\t}\n\t// console.log('updating dead entity avenge counter', boardWithDeadEntityHero.avengeCurrent, stringifySimpleCard(deadEntity, allCards));\n\tfor (const heroPower of boardWithDeadEntityHero.heroPowers) {\n\t\tconst heroAvenger = !!heroPower.avengeDefault && heroPower.avengeCurrent <= 0;\n\t\tif (heroAvenger) {\n\t\t\thandleHeroAvenge(\n\t\t\t\tdeadEntity,\n\t\t\t\theroPower,\n\t\t\t\tboardWithDeadEntity,\n\t\t\t\tboardWithDeadEntityHero,\n\t\t\t\totherBoard,\n\t\t\t\totherBoardHero,\n\t\t\t\tcandidatesEntitiesSpawnedFromAvenge,\n\t\t\t\tgameState,\n\t\t\t);\n\t\t}\n\t}\n\n\tconst questRewardAvengers = boardWithDeadEntityHero.questRewardEntities.filter(\n\t\t(e) => !!e.avengeDefault && e.avengeCurrent <= 0,\n\t);\n\tfor (const avenger of questRewardAvengers) {\n\t\thandleAvenge(\n\t\t\tboardWithDeadEntity,\n\t\t\tboardWithDeadEntityHero,\n\t\t\tdeadEntity,\n\t\t\tdeadEntityIndexFromRight,\n\t\t\tavenger as BoardEntity,\n\t\t\tcandidatesEntitiesSpawnedFromAvenge,\n\t\t\totherBoard,\n\t\t\totherBoardHero,\n\t\t\tgameState,\n\t\t);\n\t}\n\n\tconst trinketAvengers = boardWithDeadEntityHero.trinkets.filter((e) => !!e.avengeDefault && e.avengeCurrent <= 0);\n\tfor (const avenger of trinketAvengers) {\n\t\thandleAvenge(\n\t\t\tboardWithDeadEntity,\n\t\t\tboardWithDeadEntityHero,\n\t\t\tdeadEntity,\n\t\t\tdeadEntityIndexFromRight,\n\t\t\tavenger as BoardEntity,\n\t\t\tcandidatesEntitiesSpawnedFromAvenge,\n\t\t\totherBoard,\n\t\t\totherBoardHero,\n\t\t\tgameState,\n\t\t);\n\t}\n\n\tperformEntitySpawns(\n\t\tcandidatesEntitiesSpawnedFromAvenge,\n\t\tboardWithDeadEntity,\n\t\tboardWithDeadEntityHero,\n\t\tdeadEntity,\n\t\tdeadEntityIndexFromRight,\n\t\totherBoard,\n\t\totherBoardHero,\n\t\tgameState,\n\t);\n\n\t// Not an avenge, but with Avenge timing\n\tconst hasDeathrattle =\n\t\thasEntityMechanic(deadEntity, GameTag.DEATHRATTLE, gameState.allCards) ||\n\t\tdeadEntity.enchantments.some((e) => isValidDeathrattleEnchantment(e.cardId));\n\tif (hasDeathrattle) {\n\t\t// These are apparently processed after Reborn is triggered\n\t\t// http://replays.firestoneapp.com/?reviewId=5db9a191-ae9b-43a5-a072-0d460631d7a9&turn=23&action=12\n\t\t// UPDATE 2024-06-24: Multiple counterexamples of this, so I'm not sure exactly what is the right approach\n\t\t// I'm implementing the one that makes more sense to me; triggering after reborn is just too different\n\t\t// from what happens usually\n\t\t// However, we want to trigger it after all the spawns have been processed, so more or less an \"avenge\" timing?\n\t\t// Maybe even after that?\n\t\t// Update 2024-06-27 29.6.2: timing should stay the same\n\t\tboardWithDeadEntity\n\t\t\t.filter((e) => e.cardId === CardIds.GhoulAcabra_BG29_863 || e.cardId === CardIds.GhoulAcabra_BG29_863_G)\n\t\t\t.forEach((ghoul) => {\n\t\t\t\tconst buff = ghoul.cardId === CardIds.GhoulAcabra_BG29_863_G ? 2 : 1;\n\t\t\t\taddStatsToBoard(ghoul, boardWithDeadEntity, boardWithDeadEntityHero, 2 * buff, 2 * buff, gameState);\n\t\t\t});\n\t}\n\n\treturn candidatesEntitiesSpawnedFromAvenge;\n};\n\nexport const updateAvengeCounters = (board: readonly BoardEntity[], boardWithDeadEntityHero: BgsPlayerEntity) => {\n\tfor (const entity of board) {\n\t\tif (!!entity.avengeDefault) {\n\t\t\tentity.avengeCurrent -= 1;\n\t\t}\n\t}\n\tfor (const heroPower of boardWithDeadEntityHero.heroPowers) {\n\t\tif (!!heroPower.avengeDefault) {\n\t\t\theroPower.avengeCurrent -= 1;\n\t\t}\n\t}\n\n\tfor (const reward of boardWithDeadEntityHero.questRewardEntities) {\n\t\tif (!!reward.avengeDefault) {\n\t\t\treward.avengeCurrent -= 1;\n\t\t}\n\t}\n\n\tfor (const trinket of boardWithDeadEntityHero.trinkets) {\n\t\tif (!!trinket.avengeDefault) {\n\t\t\ttrinket.avengeCurrent -= 1;\n\t\t}\n\t}\n};\n\nconst handleAvenge = (\n\tboardWithDeadEntity: BoardEntity[],\n\tboardWithDeadEntityHero: BgsPlayerEntity,\n\tdeadEntity: BoardEntity,\n\tdeadEntityIndexFromRight: number,\n\tavenger: BoardEntity,\n\tcandidatesEntitiesSpawnedFromAvenge: BoardEntity[],\n\totherBoard: BoardEntity[],\n\totherBoardHero: BgsPlayerEntity,\n\tgameState: FullGameState,\n) => {\n\tconst avengeImpl = cardMappings[avenger.cardId];\n\tif (hasAvenge(avengeImpl)) {\n\t\tconst newSpawns = avengeImpl.avenge(avenger, {\n\t\t\tboard: boardWithDeadEntity,\n\t\t\thero: boardWithDeadEntityHero,\n\t\t\totherBoard: otherBoard,\n\t\t\totherHero: otherBoardHero,\n\t\t\tdeadEntity: deadEntity,\n\t\t\tgameState,\n\t\t});\n\t\tif (Array.isArray(newSpawns) && newSpawns?.length) {\n\t\t\tcandidatesEntitiesSpawnedFromAvenge.push(...newSpawns);\n\t\t}\n\t} else {\n\t\t// Don't forget to update the avenge data in cards-data\n\t\tswitch (avenger.cardId) {\n\t\t\tcase CardIds.StormpikeLieutenant_BG22_HERO_003_Buddy:\n\t\t\tcase CardIds.StormpikeLieutenant_BG22_HERO_003_Buddy_G:\n\t\t\t\t// Only for Tavern\n\t\t\t\t// addStatsToBoard(\n\t\t\t\t// \tavenger,\n\t\t\t\t// \tboardWithDeadEntity,\n\t\t\t\t// \t0,\n\t\t\t\t// \tavenger.cardId === CardIds.StormpikeLieutenant_BG22_HERO_003_Buddy_G ? 2 : 1,\n\t\t\t\t// \tgameState.allCards,\n\t\t\t\t// \tgameState.spectator,\n\t\t\t\t// );\n\t\t\t\tbreak;\n\t\t\tcase CardIds.PalescaleCrocolisk_BG21_001:\n\t\t\t\tconst target1 = grantRandomStats(\n\t\t\t\t\tavenger,\n\t\t\t\t\tboardWithDeadEntity,\n\t\t\t\t\tboardWithDeadEntityHero,\n\t\t\t\t\t6,\n\t\t\t\t\t6,\n\t\t\t\t\tRace.BEAST,\n\t\t\t\t\ttrue,\n\t\t\t\t\tgameState,\n\t\t\t\t);\n\t\t\t\tif (!!target1) {\n\t\t\t\t\tgameState.spectator.registerPowerTarget(\n\t\t\t\t\t\tavenger,\n\t\t\t\t\t\ttarget1,\n\t\t\t\t\t\tboardWithDeadEntity,\n\t\t\t\t\t\tboardWithDeadEntityHero,\n\t\t\t\t\t\totherBoardHero,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase CardIds.PalescaleCrocolisk_BG21_001_G:\n\t\t\t\tconst target2 = grantRandomStats(\n\t\t\t\t\tavenger,\n\t\t\t\t\tboardWithDeadEntity,\n\t\t\t\t\tboardWithDeadEntityHero,\n\t\t\t\t\t12,\n\t\t\t\t\t12,\n\t\t\t\t\tRace.BEAST,\n\t\t\t\t\ttrue,\n\t\t\t\t\tgameState,\n\t\t\t\t);\n\t\t\t\tif (!!target2) {\n\t\t\t\t\tgameState.spectator.registerPowerTarget(\n\t\t\t\t\t\tavenger,\n\t\t\t\t\t\ttarget2,\n\t\t\t\t\t\tboardWithDeadEntity,\n\t\t\t\t\t\tboardWithDeadEntityHero,\n\t\t\t\t\t\totherBoardHero,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase CardIds.ImpatientDoomsayer_BG21_007:\n\t\t\tcase CardIds.ImpatientDoomsayer_BG21_007_G:\n\t\t\t\tconst doomsayerCardsToAddQuantity = avenger.cardId === CardIds.ImpatientDoomsayer_BG21_007_G ? 2 : 1;\n\t\t\t\tconst doomsayerCardsToAdd = [];\n\t\t\t\tfor (let i = 0; i < doomsayerCardsToAddQuantity; i++) {\n\t\t\t\t\tdoomsayerCardsToAdd.push(pickRandom(gameState.cardsData.demonSpawns));\n\t\t\t\t}\n\t\t\t\taddCardsInHand(boardWithDeadEntityHero, boardWithDeadEntity, doomsayerCardsToAdd, gameState);\n\t\t\t\tbreak;\n\t\t\tcase CardIds.PashmarTheVengeful_BG23_014:\n\t\t\tcase CardIds.PashmarTheVengeful_BG23_014_G:\n\t\t\t\tbreak;\n\t\t\tcase CardIds.TremblingTrolley_BG28_967:\n\t\t\tcase CardIds.TremblingTrolley_BG28_967_G:\n\t\t\t\taddCardsInHand(boardWithDeadEntityHero, boardWithDeadEntity, [null], gameState);\n\t\t\t\tbreak;\n\t\t\tcase CardIds.Thorncaller_BG20_105:\n\t\t\tcase CardIds.Thorncaller_BG20_105_G:\n\t\t\t\tconst thorncallerToAddQuantity = avenger.cardId === CardIds.Thorncaller_BG20_105_G ? 2 : 1;\n\t\t\t\tconst thorncallerCardsToAdd = Array(thorncallerToAddQuantity).fill(CardIds.BloodGem);\n\t\t\t\taddCardsInHand(boardWithDeadEntityHero, boardWithDeadEntity, thorncallerCardsToAdd, gameState);\n\t\t\t\tbreak;\n\t\t\t// case CardIds.Sisefin_BG21_009:\n\t\t\t// case CardIds.Sisefin_BG21_009_G:\n\t\t\t// \tconst poisonousIterations = avenger.cardId === CardIds.Sisefin_BG21_009_G ? 2 : 1;\n\t\t\t// \tfor (let i = 0; i < poisonousIterations; i++) {\n\t\t\t// \t\tconst validTargets = boardWithDeadEntity.filter((e) => !e.poisonous && !e.venomous);\n\t\t\t// \t\tconst murloc = getRandomAliveMinion(validTargets, boardWithDeadEntityHero, Race.MURLOC, gameState);\n\t\t\t// \t\tif (murloc) {\n\t\t\t// \t\t\tupdateVenomous(\n\t\t\t// \t\t\t\tmurloc,\n\t\t\t// \t\t\t\ttrue,\n\t\t\t// \t\t\t\tboardWithDeadEntity,\n\t\t\t// \t\t\t\tboardWithDeadEntityHero,\n\t\t\t// \t\t\t\totherBoardHero,\n\t\t\t// \t\t\t\tgameState,\n\t\t\t// \t\t\t);\n\t\t\t// \t\t\tgameState.spectator.registerPowerTarget(\n\t\t\t// \t\t\t\tavenger,\n\t\t\t// \t\t\t\tmurloc,\n\t\t\t// \t\t\t\tboardWithDeadEntity,\n\t\t\t// \t\t\t\tboardWithDeadEntityHero,\n\t\t\t// \t\t\t\totherBoardHero,\n\t\t\t// \t\t\t);\n\t\t\t// \t\t}\n\t\t\t// \t}\n\t\t\t// \tbreak;\n\t\t\tcase CardIds.MechanoTank_BG21_023:\n\t\t\t\t// This can be null if the avenge triggers when the last enemy minion dies as well\n\t\t\t\tconst target = getRandomMinionWithHighestHealth(otherBoard);\n\t\t\t\tgameState.spectator.registerPowerTarget(\n\t\t\t\t\tavenger,\n\t\t\t\t\ttarget,\n\t\t\t\t\totherBoard,\n\t\t\t\t\tboardWithDeadEntityHero,\n\t\t\t\t\totherBoardHero,\n\t\t\t\t);\n\t\t\t\tdealDamageToMinion(\n\t\t\t\t\ttarget,\n\t\t\t\t\totherBoard,\n\t\t\t\t\totherBoardHero,\n\t\t\t\t\tavenger,\n\t\t\t\t\t5,\n\t\t\t\t\tboardWithDeadEntity,\n\t\t\t\t\tboardWithDeadEntityHero,\n\t\t\t\t\tgameState,\n\t\t\t\t);\n\t\t\t\tbreak;\n\t\t\tcase CardIds.MechanoTank_BG21_023_G:\n\t\t\t\tfor (let i = 0; i < 2; i++) {\n\t\t\t\t\tconst target = getRandomMinionWithHighestHealth(otherBoard);\n\t\t\t\t\tgameState.spectator.registerPowerTarget(\n\t\t\t\t\t\tavenger,\n\t\t\t\t\t\ttarget,\n\t\t\t\t\t\totherBoard,\n\t\t\t\t\t\tboardWithDeadEntityHero,\n\t\t\t\t\t\totherBoardHero,\n\t\t\t\t\t);\n\t\t\t\t\tdealDamageToMinion(\n\t\t\t\t\t\ttarget,\n\t\t\t\t\t\totherBoard,\n\t\t\t\t\t\totherBoardHero,\n\t\t\t\t\t\tavenger,\n\t\t\t\t\t\t5,\n\t\t\t\t\t\tboardWithDeadEntity,\n\t\t\t\t\t\tboardWithDeadEntityHero,\n\t\t\t\t\t\tgameState,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t// case CardIds.TonyTwoTusk_BG21_031:\n\t\t\t// \tconst nonGoldenMinions = boardWithDeadEntity\n\t\t\t// \t\t.filter((e) => e.entityId !== avenger.entityId)\n\t\t\t// \t\t.filter((e) => {\n\t\t\t// \t\t\tconst ref = gameState.allCards.getCard(e.cardId);\n\t\t\t// \t\t\treturn (\n\t\t\t// \t\t\t\t!!ref.battlegroundsPremiumDbfId &&\n\t\t\t// \t\t\t\t!!gameState.allCards.getCardFromDbfId(ref.battlegroundsPremiumDbfId).id\n\t\t\t// \t\t\t);\n\t\t\t// \t\t});\n\t\t\t// \tconst pirate = getRandomAliveMinion(nonGoldenMinions, boardWithDeadEntityHero, Race.PIRATE, gameState);\n\t\t\t// \tif (pirate) {\n\t\t\t// \t\tmakeMinionGolden(\n\t\t\t// \t\t\tpirate,\n\t\t\t// \t\t\tavenger,\n\t\t\t// \t\t\tboardWithDeadEntity,\n\t\t\t// \t\t\tboardWithDeadEntityHero,\n\t\t\t// \t\t\totherBoard,\n\t\t\t// \t\t\totherBoardHero,\n\t\t\t// \t\t\tgameState,\n\t\t\t// \t\t);\n\t\t\t// \t}\n\t\t\t// \tbreak;\n\t\t\t// case CardIds.TonyTwoTusk_BG21_031_G:\n\t\t\t// \tfor (let i = 0; i < 2; i++) {\n\t\t\t// \t\tconst nonGoldenMinions = boardWithDeadEntity.filter((e) => !isMinionGolden(e, gameState.allCards));\n\t\t\t// \t\tconst pirate = getRandomAliveMinion(\n\t\t\t// \t\t\tnonGoldenMinions,\n\t\t\t// \t\t\tboardWithDeadEntityHero,\n\t\t\t// \t\t\tRace.PIRATE,\n\t\t\t// \t\t\tgameState,\n\t\t\t// \t\t);\n\t\t\t// \t\tif (pirate) {\n\t\t\t// \t\t\tmakeMinionGolden(\n\t\t\t// \t\t\t\tpirate,\n\t\t\t// \t\t\t\tavenger,\n\t\t\t// \t\t\t\tboardWithDeadEntity,\n\t\t\t// \t\t\t\tboardWithDeadEntityHero,\n\t\t\t// \t\t\t\totherBoard,\n\t\t\t// \t\t\t\totherBoardHero,\n\t\t\t// \t\t\t\tgameState,\n\t\t\t// \t\t\t);\n\t\t\t// \t\t}\n\t\t\t// \t}\n\t\t\t// \tbreak;\n\t\t\tcase CardIds.HungeringAbomination_BG25_014:\n\t\t\tcase CardIds.HungeringAbomination_BG25_014_G:\n\t\t\t\tconst abominationMultiplier = avenger.cardId === CardIds.HungeringAbomination_BG25_014_G ? 2 : 1;\n\t\t\t\tmodifyStats(\n\t\t\t\t\tavenger,\n\t\t\t\t\tavenger,\n\t\t\t\t\tabominationMultiplier * 1,\n\t\t\t\t\tabominationMultiplier * 2,\n\t\t\t\t\tboardWithDeadEntity,\n\t\t\t\t\tboardWithDeadEntityHero,\n\t\t\t\t\tgameState,\n\t\t\t\t);\n\t\t\t\tbreak;\n\t\t\t// case CardIds.IceSickle:\n\t\t\t// \tgrantRandomStats(\n\t\t\t// \t\tavenger,\n\t\t\t// \t\tboardWithDeadEntityHero.hand.filter(\n\t\t\t// \t\t\t(e) => gameState.allCards.getCard(e.cardId).type?.toUpperCase() === CardType[CardType.MINION],\n\t\t\t// \t\t),\n\t\t\t// \t\tboardWithDeadEntityHero,\n\t\t\t// \t\t4,\n\t\t\t// \t\t0,\n\t\t\t// \t\tnull,\n\t\t\t// \t\ttrue,\n\t\t\t// \t\tgameState,\n\t\t\t// \t);\n\t\t\t// \tbreak;\n\t\t\tcase CardIds.BoomSquad_BG27_Reward_502:\n\t\t\t\tconst highestHealthMinion = [...otherBoard].sort((a, b) => b.health - a.health)[0];\n\t\t\t\tdealDamageToMinion(\n\t\t\t\t\thighestHealthMinion,\n\t\t\t\t\totherBoard,\n\t\t\t\t\totherBoardHero,\n\t\t\t\t\tavenger,\n\t\t\t\t\t10,\n\t\t\t\t\tboardWithDeadEntity,\n\t\t\t\t\tboardWithDeadEntityHero,\n\t\t\t\t\tgameState,\n\t\t\t\t);\n\t\t\t\tgameState.spectator.registerPowerTarget(\n\t\t\t\t\tavenger,\n\t\t\t\t\thighestHealthMinion,\n\t\t\t\t\totherBoard,\n\t\t\t\t\tboardWithDeadEntityHero,\n\t\t\t\t\totherBoardHero,\n\t\t\t\t);\n\t\t\t\tbreak;\n\t\t\tcase CardIds.RelentlessSentry_BG25_003:\n\t\t\tcase CardIds.RelentlessSentry_BG25_003_G:\n\t\t\t\tupdateReborn(avenger, true, boardWithDeadEntity, boardWithDeadEntityHero, otherBoardHero, gameState);\n\t\t\t\tupdateTaunt(avenger, true, boardWithDeadEntity, boardWithDeadEntityHero, otherBoardHero, gameState);\n\t\t\t\tbreak;\n\t\t\tcase CardIds.RelentlessMurghoul_BG27_010:\n\t\t\tcase CardIds.RelentlessMurghoul_BG27_010_G:\n\t\t\t\tupdateReborn(avenger, true, boardWithDeadEntity, boardWithDeadEntityHero, otherBoardHero, gameState);\n\t\t\t\tupdateTaunt(avenger, true, boardWithDeadEntity, boardWithDeadEntityHero, otherBoardHero, gameState);\n\t\t\t\tbreak;\n\t\t\tcase CardIds.PhaerixWrathOfTheSun_BG28_403:\n\t\t\tcase CardIds.PhaerixWrathOfTheSun_BG28_403_G:\n\t\t\t\tconst phaerixLoops = avenger.cardId === CardIds.PhaerixWrathOfTheSun_BG28_403_G ? 2 : 1;\n\t\t\t\tfor (let i = 0; i < phaerixLoops; i++) {\n\t\t\t\t\tgrantRandomDivineShield(\n\t\t\t\t\t\tavenger,\n\t\t\t\t\t\tboardWithDeadEntity,\n\t\t\t\t\t\tboardWithDeadEntityHero,\n\t\t\t\t\t\totherBoardHero,\n\t\t\t\t\t\tgameState,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase CardIds.AugmentedLaborer_BG28_740:\n\t\t\tcase CardIds.AugmentedLaborer_BG28_740_G:\n\t\t\t\tconst AugmentedLaborerLoops = avenger.cardId === CardIds.AugmentedLaborer_BG28_740_G ? 2 : 1;\n\t\t\t\tfor (let i = 0; i < AugmentedLaborerLoops; i++) {\n\t\t\t\t\taddCardsInHand(boardWithDeadEntityHero, boardWithDeadEntity, [null], gameState);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase CardIds.TumblingDisaster_BG28_Reward_505:\n\t\t\t\tconst tumblingDisasterEntity = boardWithDeadEntityHero.questRewardEntities?.find(\n\t\t\t\t\t(e) => e.cardId === CardIds.TumblingDisaster_BG28_Reward_505,\n\t\t\t\t);\n\t\t\t\tif (tumblingDisasterEntity) {\n\t\t\t\t\ttumblingDisasterEntity.scriptDataNum1 = (tumblingDisasterEntity.scriptDataNum1 ?? 0) + 1;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase CardIds.CycleOfEnergy_BG28_Reward_504:\n\t\t\t\taddCardsInHand(boardWithDeadEntityHero, boardWithDeadEntity, [null], gameState);\n\t\t\t\tbreak;\n\t\t\tcase CardIds.StableAmalgamation_BG28_Reward_518:\n\t\t\t\tavenger.scriptDataNum1 = (avenger.scriptDataNum1 ?? 0) + 1;\n\t\t\t\tbreak;\n\t\t\tcase CardIds.MurglMkIi_BG29_991:\n\t\t\tcase CardIds.MurglMkIi_BG29_991_G:\n\t\t\t\tconst murglMkStats = avenger.cardId === CardIds.MurglMkIi_BG29_991_G ? 2 : 1;\n\t\t\t\taddStatsToBoard(\n\t\t\t\t\tavenger,\n\t\t\t\t\tboardWithDeadEntity,\n\t\t\t\t\tboardWithDeadEntityHero,\n\t\t\t\t\tmurglMkStats,\n\t\t\t\t\tmurglMkStats,\n\t\t\t\t\tgameState,\n\t\t\t\t);\n\t\t\t\t// Don't use utility methods, as we don't want triggers to proc\n\t\t\t\tfor (const e of boardWithDeadEntityHero.hand ?? []) {\n\t\t\t\t\te.attack += murglMkStats;\n\t\t\t\t\te.health += murglMkStats;\n\t\t\t\t\te.maxHealth += murglMkStats;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase CardIds.StaffOfTheScourge_BG30_MagicItem_437:\n\t\t\t\tif (boardWithDeadEntity.length > 0) {\n\t\t\t\t\tconst candidates = boardWithDeadEntity.filter(\n\t\t\t\t\t\t(e) =>\n\t\t\t\t\t\t\t!e.reborn &&\n\t\t\t\t\t\t\thasCorrectTribe(\n\t\t\t\t\t\t\t\te,\n\t\t\t\t\t\t\t\tboardWithDeadEntityHero,\n\t\t\t\t\t\t\t\tRace.UNDEAD,\n\t\t\t\t\t\t\t\tgameState.anomalies,\n\t\t\t\t\t\t\t\tgameState.allCards,\n\t\t\t\t\t\t\t),\n\t\t\t\t\t);\n\t\t\t\t\tconst target = pickRandom(candidates);\n\t\t\t\t\tif (!!target) {\n\t\t\t\t\t\tupdateReborn(\n\t\t\t\t\t\t\ttarget,\n\t\t\t\t\t\t\ttrue,\n\t\t\t\t\t\t\tboardWithDeadEntity,\n\t\t\t\t\t\t\tboardWithDeadEntityHero,\n\t\t\t\t\t\t\totherBoardHero,\n\t\t\t\t\t\t\tgameState,\n\t\t\t\t\t\t);\n\t\t\t\t\t\tgameState.spectator.registerPowerTarget(\n\t\t\t\t\t\t\tavenger,\n\t\t\t\t\t\t\ttarget,\n\t\t\t\t\t\t\tboardWithDeadEntity,\n\t\t\t\t\t\t\tboardWithDeadEntityHero,\n\t\t\t\t\t\t\totherBoardHero,\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase CardIds.BleedingHeart_BG30_MagicItem_713:\n\t\t\t\tconst randomUndead = gameState.cardsData.getRandomMinionForTribe(\n\t\t\t\t\tRace.UNDEAD,\n\t\t\t\t\tboardWithDeadEntityHero.tavernTier,\n\t\t\t\t);\n\t\t\t\taddCardsInHand(boardWithDeadEntityHero, boardWithDeadEntity, [randomUndead], gameState);\n\t\t\t\tbreak;\n\t\t}\n\t}\n\tavenger.avengeCurrent += avenger.avengeDefault;\n};\n\nconst handleHeroAvenge = (\n\tdeadEntity: BoardEntity,\n\theroPower: BgsHeroPower,\n\tboardWithDeadEntity: BoardEntity[],\n\tboardWithDeadEntityHero: BgsPlayerEntity,\n\totherBoard: BoardEntity[],\n\totherBoardHero: BgsPlayerEntity,\n\tcandidatesEntitiesSpawnedFromAvenge: BoardEntity[],\n\tgameState: FullGameState,\n) => {\n\t// https://twitter.com/LoewenMitchell/status/1491879869457879040\n\t// Not affected by Khadgar\n\tswitch (heroPower.cardId) {\n\t\tcase CardIds.Onyxia_Broodmother:\n\t\t\tconst broodmotherTokens = spawnEntities(\n\t\t\t\tCardIds.Onyxia_OnyxianWhelpToken,\n\t\t\t\t1,\n\t\t\t\tboardWithDeadEntity,\n\t\t\t\tboardWithDeadEntityHero,\n\t\t\t\totherBoard,\n\t\t\t\totherBoardHero,\n\t\t\t\tgameState,\n\t\t\t\tdeadEntity.friendly,\n\t\t\t\tfalse,\n\t\t\t\tfalse,\n\t\t\t\tfalse,\n\t\t\t);\n\t\t\tbroodmotherTokens.forEach((token) => {\n\t\t\t\ttoken.attack = +heroPower.info;\n\t\t\t\ttoken.health = +heroPower.info;\n\t\t\t\ttoken.maxAttack = +heroPower.info;\n\t\t\t\ttoken.maxHealth = +heroPower.info;\n\t\t\t});\n\t\t\theroPower.info = +heroPower.info + 1;\n\t\t\tcandidatesEntitiesSpawnedFromAvenge.push(...broodmotherTokens);\n\t\t\tbreak;\n\t}\n\theroPower.avengeCurrent += heroPower.avengeDefault;\n};\n\nexport interface AvengeInput {\n\treadonly board: BoardEntity[];\n\treadonly deadEntity: BoardEntity;\n\treadonly hero: BgsPlayerEntity;\n\treadonly otherBoard: BoardEntity[];\n\treadonly otherHero: BgsPlayerEntity;\n\treadonly gameState: FullGameState;\n}\n"]}
1
+ {"version":3,"file":"avenge.js","sourceRoot":"","sources":["../../src/simulation/avenge.ts"],"names":[],"mappings":";;;AAAA,iEAA6D;AAG7D,4DAAoD;AACpD,iEAA4D;AAC5D,6DAAoE;AACpE,+CAAkD;AAClD,6CAAgD;AAEhD,6CAA+C;AAC/C,gEAAuE;AACvE,oCAMkB;AAClB,qCAA8C;AAC9C,mDAAiD;AACjD,6DAAqD;AAErD,qCAA+C;AAC/C,mCAAsC;AAE/B,MAAM,kBAAkB,GAAG,CACjC,UAAuB,EACvB,wBAAgC,EAChC,mBAAkC,EAClC,uBAAwC,EACxC,UAAyB,EACzB,cAA+B,EAC/B,SAAwB,E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GAAG,CAAC,CAAC;YACrC,mCAAmC,CAAC,IAAI,CAAC,GAAG,iBAAiB,CAAC,CAAC;YAC/D,MAAM;KACP;IACD,SAAS,CAAC,aAAa,IAAI,SAAS,CAAC,aAAa,CAAC;AACpD,CAAC,CAAC","sourcesContent":["import { GameTag, Race } from '@firestone-hs/reference-data';\nimport { BgsHeroPower, BgsPlayerEntity } from '../bgs-player-entity';\nimport { BoardEntity } from '../board-entity';\nimport { hasAvenge } from '../cards/card.interface';\nimport { cardMappings } from '../cards/impl/_card-mappings';\nimport { grantRandomDivineShield } from '../keywords/divine-shield';\nimport { updateReborn } from '../keywords/reborn';\nimport { updateTaunt } from '../keywords/taunt';\nimport { CardIds } from '../services/card-ids';\nimport { pickRandom } from '../services/utils';\nimport { isValidDeathrattleEnchantment } from '../simulate-bgs-battle';\nimport {\n\taddStatsToBoard,\n\tgetRandomMinionWithHighestHealth,\n\tgrantRandomStats,\n\thasCorrectTribe,\n\thasEntityMechanic,\n} from '../utils';\nimport { dealDamageToMinion } from './attack';\nimport { addCardsInHand } from './cards-in-hand';\nimport { spawnEntities } from './deathrattle-spawns';\nimport { FullGameState } from './internal-game-state';\nimport { performEntitySpawns } from './spawns';\nimport { modifyStats } from './stats';\n\nexport const applyAvengeEffects = (\n\tdeadEntity: BoardEntity,\n\tdeadEntityIndexFromRight: number,\n\tboardWithDeadEntity: BoardEntity[],\n\tboardWithDeadEntityHero: BgsPlayerEntity,\n\totherBoard: BoardEntity[],\n\totherBoardHero: BgsPlayerEntity,\n\tgameState: FullGameState,\n\tentitiesSpawnedFromMinionDeath: BoardEntity[],\n): BoardEntity[] => {\n\tconst candidatesEntitiesSpawnedFromAvenge: BoardEntity[] = [];\n\t// updateAvengeCounters(boardWithDeadEntity, boardWithDeadEntityHero);\n\tconst avengers = boardWithDeadEntity\n\t\t.filter((e) => !!e.avengeDefault && e.avengeCurrent <= 0)\n\t\t// Get Tony to be processed first, because of the \"when turned golden, the minion ignores the death for the avenge counter\"\n\t\t// behavior\n\t\t.sort((a, b) => {\n\t\t\t// if (a.cardId === CardIds.TonyTwoTusk_BG21_031 || a.cardId === CardIds.TonyTwoTusk_BG21_031_G) {\n\t\t\t// \treturn -1;\n\t\t\t// }\n\t\t\t// if (b.cardId === CardIds.TonyTwoTusk_BG21_031 || b.cardId === CardIds.TonyTwoTusk_BG21_031_G) {\n\t\t\t// \treturn 1;\n\t\t\t// }\n\t\t\treturn 0;\n\t\t});\n\tfor (const avenger of avengers) {\n\t\thandleAvenge(\n\t\t\tboardWithDeadEntity,\n\t\t\tboardWithDeadEntityHero,\n\t\t\tdeadEntity,\n\t\t\tdeadEntityIndexFromRight,\n\t\t\tavenger,\n\t\t\tcandidatesEntitiesSpawnedFromAvenge,\n\t\t\totherBoard,\n\t\t\totherBoardHero,\n\t\t\tgameState,\n\t\t);\n\t}\n\t// console.log('updating dead entity avenge counter', boardWithDeadEntityHero.avengeCurrent, stringifySimpleCard(deadEntity, allCards));\n\tfor (const heroPower of boardWithDeadEntityHero.heroPowers) {\n\t\tconst heroAvenger = !!heroPower.avengeDefault && heroPower.avengeCurrent <= 0;\n\t\tif (heroAvenger) {\n\t\t\thandleHeroAvenge(\n\t\t\t\tdeadEntity,\n\t\t\t\theroPower,\n\t\t\t\tboardWithDeadEntity,\n\t\t\t\tboardWithDeadEntityHero,\n\t\t\t\totherBoard,\n\t\t\t\totherBoardHero,\n\t\t\t\tcandidatesEntitiesSpawnedFromAvenge,\n\t\t\t\tgameState,\n\t\t\t);\n\t\t}\n\t}\n\n\tconst questRewardAvengers = boardWithDeadEntityHero.questRewardEntities.filter(\n\t\t(e) => !!e.avengeDefault && e.avengeCurrent <= 0,\n\t);\n\tfor (const avenger of questRewardAvengers) {\n\t\thandleAvenge(\n\t\t\tboardWithDeadEntity,\n\t\t\tboardWithDeadEntityHero,\n\t\t\tdeadEntity,\n\t\t\tdeadEntityIndexFromRight,\n\t\t\tavenger as BoardEntity,\n\t\t\tcandidatesEntitiesSpawnedFromAvenge,\n\t\t\totherBoard,\n\t\t\totherBoardHero,\n\t\t\tgameState,\n\t\t);\n\t}\n\n\tconst trinketAvengers = boardWithDeadEntityHero.trinkets.filter((e) => !!e.avengeDefault && e.avengeCurrent <= 0);\n\tfor (const avenger of trinketAvengers) {\n\t\thandleAvenge(\n\t\t\tboardWithDeadEntity,\n\t\t\tboardWithDeadEntityHero,\n\t\t\tdeadEntity,\n\t\t\tdeadEntityIndexFromRight,\n\t\t\tavenger as BoardEntity,\n\t\t\tcandidatesEntitiesSpawnedFromAvenge,\n\t\t\totherBoard,\n\t\t\totherBoardHero,\n\t\t\tgameState,\n\t\t);\n\t}\n\n\tperformEntitySpawns(\n\t\tcandidatesEntitiesSpawnedFromAvenge,\n\t\tboardWithDeadEntity,\n\t\tboardWithDeadEntityHero,\n\t\tdeadEntity,\n\t\tdeadEntityIndexFromRight,\n\t\totherBoard,\n\t\totherBoardHero,\n\t\tgameState,\n\t);\n\n\t// Not an avenge, but with Avenge timing\n\tconst hasDeathrattle =\n\t\thasEntityMechanic(deadEntity, GameTag.DEATHRATTLE, gameState.allCards) ||\n\t\tdeadEntity.enchantments.some((e) => isValidDeathrattleEnchantment(e.cardId));\n\tif (hasDeathrattle) {\n\t\t// These are apparently processed after Reborn is triggered\n\t\t// http://replays.firestoneapp.com/?reviewId=5db9a191-ae9b-43a5-a072-0d460631d7a9&turn=23&action=12\n\t\t// UPDATE 2024-06-24: Multiple counterexamples of this, so I'm not sure exactly what is the right approach\n\t\t// I'm implementing the one that makes more sense to me; triggering after reborn is just too different\n\t\t// from what happens usually\n\t\t// However, we want to trigger it after all the spawns have been processed, so more or less an \"avenge\" timing?\n\t\t// Maybe even after that?\n\t\t// Update 2024-06-27 29.6.2: timing should stay the same\n\t\tboardWithDeadEntity\n\t\t\t.filter((e) => e.cardId === CardIds.GhoulAcabra_BG29_863 || e.cardId === CardIds.GhoulAcabra_BG29_863_G)\n\t\t\t.forEach((ghoul) => {\n\t\t\t\tconst buff = ghoul.cardId === CardIds.GhoulAcabra_BG29_863_G ? 2 : 1;\n\t\t\t\taddStatsToBoard(ghoul, boardWithDeadEntity, boardWithDeadEntityHero, 2 * buff, 2 * buff, gameState);\n\t\t\t});\n\t}\n\n\treturn candidatesEntitiesSpawnedFromAvenge;\n};\n\nexport const updateAvengeCounters = (board: readonly BoardEntity[], boardWithDeadEntityHero: BgsPlayerEntity) => {\n\tfor (const entity of board) {\n\t\tif (!!entity.avengeDefault) {\n\t\t\tentity.avengeCurrent -= 1;\n\t\t}\n\t}\n\tfor (const heroPower of boardWithDeadEntityHero.heroPowers) {\n\t\tif (!!heroPower.avengeDefault) {\n\t\t\theroPower.avengeCurrent -= 1;\n\t\t}\n\t}\n\n\tfor (const reward of boardWithDeadEntityHero.questRewardEntities) {\n\t\tif (!!reward.avengeDefault) {\n\t\t\treward.avengeCurrent -= 1;\n\t\t}\n\t}\n\n\tfor (const trinket of boardWithDeadEntityHero.trinkets) {\n\t\tif (!!trinket.avengeDefault) {\n\t\t\ttrinket.avengeCurrent -= 1;\n\t\t}\n\t}\n};\n\nconst handleAvenge = (\n\tboardWithDeadEntity: BoardEntity[],\n\tboardWithDeadEntityHero: BgsPlayerEntity,\n\tdeadEntity: BoardEntity,\n\tdeadEntityIndexFromRight: number,\n\tavenger: BoardEntity,\n\tcandidatesEntitiesSpawnedFromAvenge: BoardEntity[],\n\totherBoard: BoardEntity[],\n\totherBoardHero: BgsPlayerEntity,\n\tgameState: FullGameState,\n) => {\n\tconst avengeImpl = cardMappings[avenger.cardId];\n\tif (hasAvenge(avengeImpl)) {\n\t\tconst newSpawns = avengeImpl.avenge(avenger, {\n\t\t\tboard: boardWithDeadEntity,\n\t\t\thero: boardWithDeadEntityHero,\n\t\t\totherBoard: otherBoard,\n\t\t\totherHero: otherBoardHero,\n\t\t\tdeadEntity: deadEntity,\n\t\t\tgameState,\n\t\t});\n\t\tif (Array.isArray(newSpawns) && newSpawns?.length) {\n\t\t\tconst avengeMinionIndexFromRight = boardWithDeadEntity.length - (boardWithDeadEntity.indexOf(avenger) + 1);\n\t\t\tnewSpawns.forEach((e: BoardEntity) => {\n\t\t\t\te.spawnIndexFromRight = avengeMinionIndexFromRight;\n\t\t\t});\n\t\t\tcandidatesEntitiesSpawnedFromAvenge.push(...newSpawns);\n\t\t}\n\t} else {\n\t\t// Don't forget to update the avenge data in cards-data\n\t\tswitch (avenger.cardId) {\n\t\t\tcase CardIds.StormpikeLieutenant_BG22_HERO_003_Buddy:\n\t\t\tcase CardIds.StormpikeLieutenant_BG22_HERO_003_Buddy_G:\n\t\t\t\t// Only for Tavern\n\t\t\t\t// addStatsToBoard(\n\t\t\t\t// \tavenger,\n\t\t\t\t// \tboardWithDeadEntity,\n\t\t\t\t// \t0,\n\t\t\t\t// \tavenger.cardId === CardIds.StormpikeLieutenant_BG22_HERO_003_Buddy_G ? 2 : 1,\n\t\t\t\t// \tgameState.allCards,\n\t\t\t\t// \tgameState.spectator,\n\t\t\t\t// );\n\t\t\t\tbreak;\n\t\t\tcase CardIds.PalescaleCrocolisk_BG21_001:\n\t\t\t\tconst target1 = grantRandomStats(\n\t\t\t\t\tavenger,\n\t\t\t\t\tboardWithDeadEntity,\n\t\t\t\t\tboardWithDeadEntityHero,\n\t\t\t\t\t6,\n\t\t\t\t\t6,\n\t\t\t\t\tRace.BEAST,\n\t\t\t\t\ttrue,\n\t\t\t\t\tgameState,\n\t\t\t\t);\n\t\t\t\tif (!!target1) {\n\t\t\t\t\tgameState.spectator.registerPowerTarget(\n\t\t\t\t\t\tavenger,\n\t\t\t\t\t\ttarget1,\n\t\t\t\t\t\tboardWithDeadEntity,\n\t\t\t\t\t\tboardWithDeadEntityHero,\n\t\t\t\t\t\totherBoardHero,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase CardIds.PalescaleCrocolisk_BG21_001_G:\n\t\t\t\tconst target2 = grantRandomStats(\n\t\t\t\t\tavenger,\n\t\t\t\t\tboardWithDeadEntity,\n\t\t\t\t\tboardWithDeadEntityHero,\n\t\t\t\t\t12,\n\t\t\t\t\t12,\n\t\t\t\t\tRace.BEAST,\n\t\t\t\t\ttrue,\n\t\t\t\t\tgameState,\n\t\t\t\t);\n\t\t\t\tif (!!target2) {\n\t\t\t\t\tgameState.spectator.registerPowerTarget(\n\t\t\t\t\t\tavenger,\n\t\t\t\t\t\ttarget2,\n\t\t\t\t\t\tboardWithDeadEntity,\n\t\t\t\t\t\tboardWithDeadEntityHero,\n\t\t\t\t\t\totherBoardHero,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase CardIds.ImpatientDoomsayer_BG21_007:\n\t\t\tcase CardIds.ImpatientDoomsayer_BG21_007_G:\n\t\t\t\tconst doomsayerCardsToAddQuantity = avenger.cardId === CardIds.ImpatientDoomsayer_BG21_007_G ? 2 : 1;\n\t\t\t\tconst doomsayerCardsToAdd = [];\n\t\t\t\tfor (let i = 0; i < doomsayerCardsToAddQuantity; i++) {\n\t\t\t\t\tdoomsayerCardsToAdd.push(pickRandom(gameState.cardsData.demonSpawns));\n\t\t\t\t}\n\t\t\t\taddCardsInHand(boardWithDeadEntityHero, boardWithDeadEntity, doomsayerCardsToAdd, gameState);\n\t\t\t\tbreak;\n\t\t\tcase CardIds.PashmarTheVengeful_BG23_014:\n\t\t\tcase CardIds.PashmarTheVengeful_BG23_014_G:\n\t\t\t\tbreak;\n\t\t\tcase CardIds.TremblingTrolley_BG28_967:\n\t\t\tcase CardIds.TremblingTrolley_BG28_967_G:\n\t\t\t\taddCardsInHand(boardWithDeadEntityHero, boardWithDeadEntity, [null], gameState);\n\t\t\t\tbreak;\n\t\t\tcase CardIds.Thorncaller_BG20_105:\n\t\t\tcase CardIds.Thorncaller_BG20_105_G:\n\t\t\t\tconst thorncallerToAddQuantity = avenger.cardId === CardIds.Thorncaller_BG20_105_G ? 2 : 1;\n\t\t\t\tconst thorncallerCardsToAdd = Array(thorncallerToAddQuantity).fill(CardIds.BloodGem);\n\t\t\t\taddCardsInHand(boardWithDeadEntityHero, boardWithDeadEntity, thorncallerCardsToAdd, gameState);\n\t\t\t\tbreak;\n\t\t\t// case CardIds.Sisefin_BG21_009:\n\t\t\t// case CardIds.Sisefin_BG21_009_G:\n\t\t\t// \tconst poisonousIterations = avenger.cardId === CardIds.Sisefin_BG21_009_G ? 2 : 1;\n\t\t\t// \tfor (let i = 0; i < poisonousIterations; i++) {\n\t\t\t// \t\tconst validTargets = boardWithDeadEntity.filter((e) => !e.poisonous && !e.venomous);\n\t\t\t// \t\tconst murloc = getRandomAliveMinion(validTargets, boardWithDeadEntityHero, Race.MURLOC, gameState);\n\t\t\t// \t\tif (murloc) {\n\t\t\t// \t\t\tupdateVenomous(\n\t\t\t// \t\t\t\tmurloc,\n\t\t\t// \t\t\t\ttrue,\n\t\t\t// \t\t\t\tboardWithDeadEntity,\n\t\t\t// \t\t\t\tboardWithDeadEntityHero,\n\t\t\t// \t\t\t\totherBoardHero,\n\t\t\t// \t\t\t\tgameState,\n\t\t\t// \t\t\t);\n\t\t\t// \t\t\tgameState.spectator.registerPowerTarget(\n\t\t\t// \t\t\t\tavenger,\n\t\t\t// \t\t\t\tmurloc,\n\t\t\t// \t\t\t\tboardWithDeadEntity,\n\t\t\t// \t\t\t\tboardWithDeadEntityHero,\n\t\t\t// \t\t\t\totherBoardHero,\n\t\t\t// \t\t\t);\n\t\t\t// \t\t}\n\t\t\t// \t}\n\t\t\t// \tbreak;\n\t\t\tcase CardIds.MechanoTank_BG21_023:\n\t\t\t\t// This can be null if the avenge triggers when the last enemy minion dies as well\n\t\t\t\tconst target = getRandomMinionWithHighestHealth(otherBoard);\n\t\t\t\tgameState.spectator.registerPowerTarget(\n\t\t\t\t\tavenger,\n\t\t\t\t\ttarget,\n\t\t\t\t\totherBoard,\n\t\t\t\t\tboardWithDeadEntityHero,\n\t\t\t\t\totherBoardHero,\n\t\t\t\t);\n\t\t\t\tdealDamageToMinion(\n\t\t\t\t\ttarget,\n\t\t\t\t\totherBoard,\n\t\t\t\t\totherBoardHero,\n\t\t\t\t\tavenger,\n\t\t\t\t\t5,\n\t\t\t\t\tboardWithDeadEntity,\n\t\t\t\t\tboardWithDeadEntityHero,\n\t\t\t\t\tgameState,\n\t\t\t\t);\n\t\t\t\tbreak;\n\t\t\tcase CardIds.MechanoTank_BG21_023_G:\n\t\t\t\tfor (let i = 0; i < 2; i++) {\n\t\t\t\t\tconst target = getRandomMinionWithHighestHealth(otherBoard);\n\t\t\t\t\tgameState.spectator.registerPowerTarget(\n\t\t\t\t\t\tavenger,\n\t\t\t\t\t\ttarget,\n\t\t\t\t\t\totherBoard,\n\t\t\t\t\t\tboardWithDeadEntityHero,\n\t\t\t\t\t\totherBoardHero,\n\t\t\t\t\t);\n\t\t\t\t\tdealDamageToMinion(\n\t\t\t\t\t\ttarget,\n\t\t\t\t\t\totherBoard,\n\t\t\t\t\t\totherBoardHero,\n\t\t\t\t\t\tavenger,\n\t\t\t\t\t\t5,\n\t\t\t\t\t\tboardWithDeadEntity,\n\t\t\t\t\t\tboardWithDeadEntityHero,\n\t\t\t\t\t\tgameState,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t// case CardIds.TonyTwoTusk_BG21_031:\n\t\t\t// \tconst nonGoldenMinions = boardWithDeadEntity\n\t\t\t// \t\t.filter((e) => e.entityId !== avenger.entityId)\n\t\t\t// \t\t.filter((e) => {\n\t\t\t// \t\t\tconst ref = gameState.allCards.getCard(e.cardId);\n\t\t\t// \t\t\treturn (\n\t\t\t// \t\t\t\t!!ref.battlegroundsPremiumDbfId &&\n\t\t\t// \t\t\t\t!!gameState.allCards.getCardFromDbfId(ref.battlegroundsPremiumDbfId).id\n\t\t\t// \t\t\t);\n\t\t\t// \t\t});\n\t\t\t// \tconst pirate = getRandomAliveMinion(nonGoldenMinions, boardWithDeadEntityHero, Race.PIRATE, gameState);\n\t\t\t// \tif (pirate) {\n\t\t\t// \t\tmakeMinionGolden(\n\t\t\t// \t\t\tpirate,\n\t\t\t// \t\t\tavenger,\n\t\t\t// \t\t\tboardWithDeadEntity,\n\t\t\t// \t\t\tboardWithDeadEntityHero,\n\t\t\t// \t\t\totherBoard,\n\t\t\t// \t\t\totherBoardHero,\n\t\t\t// \t\t\tgameState,\n\t\t\t// \t\t);\n\t\t\t// \t}\n\t\t\t// \tbreak;\n\t\t\t// case CardIds.TonyTwoTusk_BG21_031_G:\n\t\t\t// \tfor (let i = 0; i < 2; i++) {\n\t\t\t// \t\tconst nonGoldenMinions = boardWithDeadEntity.filter((e) => !isMinionGolden(e, gameState.allCards));\n\t\t\t// \t\tconst pirate = getRandomAliveMinion(\n\t\t\t// \t\t\tnonGoldenMinions,\n\t\t\t// \t\t\tboardWithDeadEntityHero,\n\t\t\t// \t\t\tRace.PIRATE,\n\t\t\t// \t\t\tgameState,\n\t\t\t// \t\t);\n\t\t\t// \t\tif (pirate) {\n\t\t\t// \t\t\tmakeMinionGolden(\n\t\t\t// \t\t\t\tpirate,\n\t\t\t// \t\t\t\tavenger,\n\t\t\t// \t\t\t\tboardWithDeadEntity,\n\t\t\t// \t\t\t\tboardWithDeadEntityHero,\n\t\t\t// \t\t\t\totherBoard,\n\t\t\t// \t\t\t\totherBoardHero,\n\t\t\t// \t\t\t\tgameState,\n\t\t\t// \t\t\t);\n\t\t\t// \t\t}\n\t\t\t// \t}\n\t\t\t// \tbreak;\n\t\t\tcase CardIds.HungeringAbomination_BG25_014:\n\t\t\tcase CardIds.HungeringAbomination_BG25_014_G:\n\t\t\t\tconst abominationMultiplier = avenger.cardId === CardIds.HungeringAbomination_BG25_014_G ? 2 : 1;\n\t\t\t\tmodifyStats(\n\t\t\t\t\tavenger,\n\t\t\t\t\tavenger,\n\t\t\t\t\tabominationMultiplier * 1,\n\t\t\t\t\tabominationMultiplier * 2,\n\t\t\t\t\tboardWithDeadEntity,\n\t\t\t\t\tboardWithDeadEntityHero,\n\t\t\t\t\tgameState,\n\t\t\t\t);\n\t\t\t\tbreak;\n\t\t\t// case CardIds.IceSickle:\n\t\t\t// \tgrantRandomStats(\n\t\t\t// \t\tavenger,\n\t\t\t// \t\tboardWithDeadEntityHero.hand.filter(\n\t\t\t// \t\t\t(e) => gameState.allCards.getCard(e.cardId).type?.toUpperCase() === CardType[CardType.MINION],\n\t\t\t// \t\t),\n\t\t\t// \t\tboardWithDeadEntityHero,\n\t\t\t// \t\t4,\n\t\t\t// \t\t0,\n\t\t\t// \t\tnull,\n\t\t\t// \t\ttrue,\n\t\t\t// \t\tgameState,\n\t\t\t// \t);\n\t\t\t// \tbreak;\n\t\t\tcase CardIds.BoomSquad_BG27_Reward_502:\n\t\t\t\tconst highestHealthMinion = [...otherBoard].sort((a, b) => b.health - a.health)[0];\n\t\t\t\tdealDamageToMinion(\n\t\t\t\t\thighestHealthMinion,\n\t\t\t\t\totherBoard,\n\t\t\t\t\totherBoardHero,\n\t\t\t\t\tavenger,\n\t\t\t\t\t10,\n\t\t\t\t\tboardWithDeadEntity,\n\t\t\t\t\tboardWithDeadEntityHero,\n\t\t\t\t\tgameState,\n\t\t\t\t);\n\t\t\t\tgameState.spectator.registerPowerTarget(\n\t\t\t\t\tavenger,\n\t\t\t\t\thighestHealthMinion,\n\t\t\t\t\totherBoard,\n\t\t\t\t\tboardWithDeadEntityHero,\n\t\t\t\t\totherBoardHero,\n\t\t\t\t);\n\t\t\t\tbreak;\n\t\t\tcase CardIds.RelentlessSentry_BG25_003:\n\t\t\tcase CardIds.RelentlessSentry_BG25_003_G:\n\t\t\t\tupdateReborn(avenger, true, boardWithDeadEntity, boardWithDeadEntityHero, otherBoardHero, gameState);\n\t\t\t\tupdateTaunt(avenger, true, boardWithDeadEntity, boardWithDeadEntityHero, otherBoardHero, gameState);\n\t\t\t\tbreak;\n\t\t\tcase CardIds.RelentlessMurghoul_BG27_010:\n\t\t\tcase CardIds.RelentlessMurghoul_BG27_010_G:\n\t\t\t\tupdateReborn(avenger, true, boardWithDeadEntity, boardWithDeadEntityHero, otherBoardHero, gameState);\n\t\t\t\tupdateTaunt(avenger, true, boardWithDeadEntity, boardWithDeadEntityHero, otherBoardHero, gameState);\n\t\t\t\tbreak;\n\t\t\tcase CardIds.PhaerixWrathOfTheSun_BG28_403:\n\t\t\tcase CardIds.PhaerixWrathOfTheSun_BG28_403_G:\n\t\t\t\tconst phaerixLoops = avenger.cardId === CardIds.PhaerixWrathOfTheSun_BG28_403_G ? 2 : 1;\n\t\t\t\tfor (let i = 0; i < phaerixLoops; i++) {\n\t\t\t\t\tgrantRandomDivineShield(\n\t\t\t\t\t\tavenger,\n\t\t\t\t\t\tboardWithDeadEntity,\n\t\t\t\t\t\tboardWithDeadEntityHero,\n\t\t\t\t\t\totherBoardHero,\n\t\t\t\t\t\tgameState,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase CardIds.AugmentedLaborer_BG28_740:\n\t\t\tcase CardIds.AugmentedLaborer_BG28_740_G:\n\t\t\t\tconst AugmentedLaborerLoops = avenger.cardId === CardIds.AugmentedLaborer_BG28_740_G ? 2 : 1;\n\t\t\t\tfor (let i = 0; i < AugmentedLaborerLoops; i++) {\n\t\t\t\t\taddCardsInHand(boardWithDeadEntityHero, boardWithDeadEntity, [null], gameState);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase CardIds.TumblingDisaster_BG28_Reward_505:\n\t\t\t\tconst tumblingDisasterEntity = boardWithDeadEntityHero.questRewardEntities?.find(\n\t\t\t\t\t(e) => e.cardId === CardIds.TumblingDisaster_BG28_Reward_505,\n\t\t\t\t);\n\t\t\t\tif (tumblingDisasterEntity) {\n\t\t\t\t\ttumblingDisasterEntity.scriptDataNum1 = (tumblingDisasterEntity.scriptDataNum1 ?? 0) + 1;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase CardIds.CycleOfEnergy_BG28_Reward_504:\n\t\t\t\taddCardsInHand(boardWithDeadEntityHero, boardWithDeadEntity, [null], gameState);\n\t\t\t\tbreak;\n\t\t\tcase CardIds.StableAmalgamation_BG28_Reward_518:\n\t\t\t\tavenger.scriptDataNum1 = (avenger.scriptDataNum1 ?? 0) + 1;\n\t\t\t\tbreak;\n\t\t\tcase CardIds.MurglMkIi_BG29_991:\n\t\t\tcase CardIds.MurglMkIi_BG29_991_G:\n\t\t\t\tconst murglMkStats = avenger.cardId === CardIds.MurglMkIi_BG29_991_G ? 2 : 1;\n\t\t\t\taddStatsToBoard(\n\t\t\t\t\tavenger,\n\t\t\t\t\tboardWithDeadEntity,\n\t\t\t\t\tboardWithDeadEntityHero,\n\t\t\t\t\tmurglMkStats,\n\t\t\t\t\tmurglMkStats,\n\t\t\t\t\tgameState,\n\t\t\t\t);\n\t\t\t\t// Don't use utility methods, as we don't want triggers to proc\n\t\t\t\tfor (const e of boardWithDeadEntityHero.hand ?? []) {\n\t\t\t\t\te.attack += murglMkStats;\n\t\t\t\t\te.health += murglMkStats;\n\t\t\t\t\te.maxHealth += murglMkStats;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase CardIds.StaffOfTheScourge_BG30_MagicItem_437:\n\t\t\t\tif (boardWithDeadEntity.length > 0) {\n\t\t\t\t\tconst candidates = boardWithDeadEntity.filter(\n\t\t\t\t\t\t(e) =>\n\t\t\t\t\t\t\t!e.reborn &&\n\t\t\t\t\t\t\thasCorrectTribe(\n\t\t\t\t\t\t\t\te,\n\t\t\t\t\t\t\t\tboardWithDeadEntityHero,\n\t\t\t\t\t\t\t\tRace.UNDEAD,\n\t\t\t\t\t\t\t\tgameState.anomalies,\n\t\t\t\t\t\t\t\tgameState.allCards,\n\t\t\t\t\t\t\t),\n\t\t\t\t\t);\n\t\t\t\t\tconst target = pickRandom(candidates);\n\t\t\t\t\tif (!!target) {\n\t\t\t\t\t\tupdateReborn(\n\t\t\t\t\t\t\ttarget,\n\t\t\t\t\t\t\ttrue,\n\t\t\t\t\t\t\tboardWithDeadEntity,\n\t\t\t\t\t\t\tboardWithDeadEntityHero,\n\t\t\t\t\t\t\totherBoardHero,\n\t\t\t\t\t\t\tgameState,\n\t\t\t\t\t\t);\n\t\t\t\t\t\tgameState.spectator.registerPowerTarget(\n\t\t\t\t\t\t\tavenger,\n\t\t\t\t\t\t\ttarget,\n\t\t\t\t\t\t\tboardWithDeadEntity,\n\t\t\t\t\t\t\tboardWithDeadEntityHero,\n\t\t\t\t\t\t\totherBoardHero,\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase CardIds.BleedingHeart_BG30_MagicItem_713:\n\t\t\t\tconst randomUndead = gameState.cardsData.getRandomMinionForTribe(\n\t\t\t\t\tRace.UNDEAD,\n\t\t\t\t\tboardWithDeadEntityHero.tavernTier,\n\t\t\t\t);\n\t\t\t\taddCardsInHand(boardWithDeadEntityHero, boardWithDeadEntity, [randomUndead], gameState);\n\t\t\t\tbreak;\n\t\t}\n\t}\n\tavenger.avengeCurrent += avenger.avengeDefault;\n};\n\nconst handleHeroAvenge = (\n\tdeadEntity: BoardEntity,\n\theroPower: BgsHeroPower,\n\tboardWithDeadEntity: BoardEntity[],\n\tboardWithDeadEntityHero: BgsPlayerEntity,\n\totherBoard: BoardEntity[],\n\totherBoardHero: BgsPlayerEntity,\n\tcandidatesEntitiesSpawnedFromAvenge: BoardEntity[],\n\tgameState: FullGameState,\n) => {\n\t// https://twitter.com/LoewenMitchell/status/1491879869457879040\n\t// Not affected by Khadgar\n\tswitch (heroPower.cardId) {\n\t\tcase CardIds.Onyxia_Broodmother:\n\t\t\tconst broodmotherTokens = spawnEntities(\n\t\t\t\tCardIds.Onyxia_OnyxianWhelpToken,\n\t\t\t\t1,\n\t\t\t\tboardWithDeadEntity,\n\t\t\t\tboardWithDeadEntityHero,\n\t\t\t\totherBoard,\n\t\t\t\totherBoardHero,\n\t\t\t\tgameState,\n\t\t\t\tdeadEntity.friendly,\n\t\t\t\tfalse,\n\t\t\t\tfalse,\n\t\t\t\tfalse,\n\t\t\t);\n\t\t\tbroodmotherTokens.forEach((token) => {\n\t\t\t\ttoken.attack = +heroPower.info;\n\t\t\t\ttoken.health = +heroPower.info;\n\t\t\t\ttoken.maxAttack = +heroPower.info;\n\t\t\t\ttoken.maxHealth = +heroPower.info;\n\t\t\t});\n\t\t\theroPower.info = +heroPower.info + 1;\n\t\t\tcandidatesEntitiesSpawnedFromAvenge.push(...broodmotherTokens);\n\t\t\tbreak;\n\t}\n\theroPower.avengeCurrent += heroPower.avengeDefault;\n};\n\nexport interface AvengeInput {\n\treadonly board: BoardEntity[];\n\treadonly deadEntity: BoardEntity;\n\treadonly hero: BgsPlayerEntity;\n\treadonly otherBoard: BoardEntity[];\n\treadonly otherHero: BgsPlayerEntity;\n\treadonly gameState: FullGameState;\n}\n"]}
@@ -66,30 +66,32 @@ const handleRebornForEntity = (boardWithKilledMinion, boardWithKilledMinionHero,
66
66
  var _a;
67
67
  entity.hasAttacked = deadEntity.hasAttacked > 1 ? 1 : (_a = entityRightToSpawns === null || entityRightToSpawns === void 0 ? void 0 : entityRightToSpawns.hasAttacked) !== null && _a !== void 0 ? _a : undefined;
68
68
  });
69
- for (const entity of boardWithKilledMinion) {
70
- const rebornImpl = _card_mappings_1.cardMappings[entity.cardId];
71
- if ((0, card_interface_1.hasAfterReborn)(rebornImpl)) {
72
- rebornImpl.afterReborn(entity, {
73
- rebornEntity: deadEntity,
74
- boardWithKilledMinion,
75
- boardWithKilledMinionHero,
76
- opponentBoard,
77
- opponentBoardHero,
78
- gameState,
79
- });
69
+ for (const rebornEntity of entitiesThatWereReborn) {
70
+ for (const entity of boardWithKilledMinion) {
71
+ const rebornImpl = _card_mappings_1.cardMappings[entity.cardId];
72
+ if ((0, card_interface_1.hasAfterReborn)(rebornImpl)) {
73
+ rebornImpl.afterReborn(entity, {
74
+ rebornEntity: rebornEntity,
75
+ boardWithKilledMinion,
76
+ boardWithKilledMinionHero,
77
+ opponentBoard,
78
+ opponentBoardHero,
79
+ gameState,
80
+ });
81
+ }
80
82
  }
81
- }
82
- for (const trinket of (_b = boardWithKilledMinionHero.trinkets) !== null && _b !== void 0 ? _b : []) {
83
- const rebornImpl = _card_mappings_1.cardMappings[trinket.cardId];
84
- if ((0, card_interface_1.hasAfterReborn)(rebornImpl)) {
85
- rebornImpl.afterReborn(trinket, {
86
- rebornEntity: deadEntity,
87
- boardWithKilledMinion,
88
- boardWithKilledMinionHero,
89
- opponentBoard,
90
- opponentBoardHero,
91
- gameState,
92
- });
83
+ for (const trinket of (_b = boardWithKilledMinionHero.trinkets) !== null && _b !== void 0 ? _b : []) {
84
+ const rebornImpl = _card_mappings_1.cardMappings[trinket.cardId];
85
+ if ((0, card_interface_1.hasAfterReborn)(rebornImpl)) {
86
+ rebornImpl.afterReborn(trinket, {
87
+ rebornEntity: rebornEntity,
88
+ boardWithKilledMinion,
89
+ boardWithKilledMinionHero,
90
+ opponentBoard,
91
+ opponentBoardHero,
92
+ gameState,
93
+ });
94
+ }
93
95
  }
94
96
  }
95
97
  boardWithKilledMinion
@@ -1 +1 @@
1
- {"version":3,"file":"reborn.js","sourceRoot":"","sources":["../../src/simulation/reborn.ts"],"names":[],"mappings":";;;AAEA,4DAA+F;AAC/F,iEAA4D;AAC5D,8EAA+G;AAE/G,oCAA2C;AAC3C,6DAAqD;AAErD,qCAA+C;AAC/C,mCAAsC;AAE/B,MAAM,qBAAqB,GAAG,CACpC,qBAAoC,EACpC,yBAA0C,EAC1C,UAAuB,EACvB,wBAAgC,EAChC,aAA4B,EAC5B,iBAAkC,EAClC,SAAwB,EACjB,EAAE;;IACT,MAAM,eAAe,GAAG,CAAC,CAAC;IAC1B,IAAI,aAAa,GAAgB,IAAI,CAAC;IACtC,IACC,IAAA,sCAAkB,EAAC,UAAU,CAAC,MAAM,CAAC;SACrC,MAAA,UAAU,CAAC,YAAY,0CAAE,IAAI,CAC5B,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,wBAAuE,CACtF,CAAA,EACA;QACD,aAAa,GAAG,IAAA,qDAAiC,EAAC,UAAU,C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AAE,CAAC,GAAG,+BAA+B,EAAE,CAAC,EAAE,EAAE;QACzD,qBAAqB;aACnB,MAAM,CACN,CAAC,CAAC,EAAE,EAAE,CACL,CAAC,CAAC,MAAM,eAAwC;YAChD,CAAC,CAAC,MAAM,iBAA0C,CACnD;aACA,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE;YACd,MAAM,UAAU,GAAG,CAAC,CAAC,MAAM,iBAA0C,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YAC9E,IAAA,uBAAe,EACd,CAAC,EACD,qBAAqB,EACrB,yBAAyB,EACzB,UAAU,GAAG,CAAC,EACd,UAAU,GAAG,CAAC,EACd,SAAS,CACT,CAAC;QACH,CAAC,CAAC,CAAC;KACJ;AACF,CAAC,CAAC;AApKW,QAAA,qBAAqB,yBAoKhC","sourcesContent":["import { BgsPlayerEntity } from '../bgs-player-entity';\r\nimport { BoardEntity } from '../board-entity';\r\nimport { hasAfterReborn, hasRebornEffect, hasRebornSelfEffect } from '../cards/card.interface';\r\nimport { cardMappings } from '../cards/impl/_card-mappings';\r\nimport { buildSinrunnerBlanchyRebornEntity, isSinrunnerBlanchy } from '../cards/impl/minion/sinrunner-blanchy';\r\nimport { CardIds } from '../services/card-ids';\r\nimport { addStatsToBoard } from '../utils';\r\nimport { spawnEntities } from './deathrattle-spawns';\r\nimport { FullGameState } from './internal-game-state';\r\nimport { performEntitySpawns } from './spawns';\r\nimport { modifyStats } from './stats';\r\n\r\nexport const handleRebornForEntity = (\r\n\tboardWithKilledMinion: BoardEntity[],\r\n\tboardWithKilledMinionHero: BgsPlayerEntity,\r\n\tdeadEntity: BoardEntity,\r\n\tdeadMinionIndexFromRight: number,\r\n\topponentBoard: BoardEntity[],\r\n\topponentBoardHero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\tconst numberOfReborns = 1;\r\n\tlet entityToSpawn: BoardEntity = null;\r\n\tif (\r\n\t\tisSinrunnerBlanchy(deadEntity.cardId) ||\r\n\t\tdeadEntity.enchantments?.some(\r\n\t\t\t(e) => e.cardId === CardIds.UltraCapacitor_UltraCapacitorEnchantment_BG31_HERO_801ptje,\r\n\t\t)\r\n\t) {\r\n\t\tentityToSpawn = buildSinrunnerBlanchyRebornEntity(deadEntity);\r\n\t}\r\n\tconst entitiesFromReborn: readonly BoardEntity[] =\r\n\t\tdeadEntity.reborn && deadMinionIndexFromRight >= 0\r\n\t\t\t? spawnEntities(\r\n\t\t\t\t\tdeadEntity.cardId,\r\n\t\t\t\t\tnumberOfReborns,\r\n\t\t\t\t\tboardWithKilledMinion,\r\n\t\t\t\t\tboardWithKilledMinionHero,\r\n\t\t\t\t\topponentBoard,\r\n\t\t\t\t\topponentBoardHero,\r\n\t\t\t\t\tgameState,\r\n\t\t\t\t\tdeadEntity.friendly,\r\n\t\t\t\t\tfalse,\r\n\t\t\t\t\ttrue,\r\n\t\t\t\t\ttrue,\r\n\t\t\t\t\tentityToSpawn,\r\n\t\t\t\t\tdeadEntity,\r\n\t\t\t )\r\n\t\t\t: [];\r\n\tif (!entitiesFromReborn.length) {\r\n\t\treturn;\r\n\t}\r\n\r\n\tif (\r\n\t\tdeadEntity.cardId === CardIds.WannabeGargoyle_BG30_109 ||\r\n\t\tdeadEntity.cardId === CardIds.WannabeGargoyle_BG30_109_G\r\n\t) {\r\n\t\tentitiesFromReborn.forEach((e) => {\r\n\t\t\tconst attack = deadEntity.maxAttack;\r\n\t\t\tconst health = deadEntity.cardId === CardIds.WannabeGargoyle_BG30_109_G ? deadEntity.maxHealth : 1;\r\n\t\t\te.attack = attack;\r\n\t\t\te.health = health;\r\n\t\t});\r\n\t}\r\n\r\n\tfor (const entity of entitiesFromReborn) {\r\n\t\tconst rebornImpl = cardMappings[entity.cardId];\r\n\t\tif (hasRebornSelfEffect(rebornImpl)) {\r\n\t\t\trebornImpl.rebornSelfEffect(entity, {\r\n\t\t\t\trebornEntity: deadEntity,\r\n\t\t\t\tboardWithKilledMinion,\r\n\t\t\t\tboardWithKilledMinionHero,\r\n\t\t\t\topponentBoard,\r\n\t\t\t\topponentBoardHero,\r\n\t\t\t\tgameState,\r\n\t\t\t});\r\n\t\t}\r\n\t}\r\n\r\n\tfor (const entity of boardWithKilledMinion) {\r\n\t\tconst rebornImpl = cardMappings[entity.cardId];\r\n\t\tif (hasRebornEffect(rebornImpl)) {\r\n\t\t\trebornImpl.rebornEffect(entity, {\r\n\t\t\t\trebornEntity: deadEntity,\r\n\t\t\t\tboardWithKilledMinion,\r\n\t\t\t\tboardWithKilledMinionHero,\r\n\t\t\t\topponentBoard,\r\n\t\t\t\topponentBoardHero,\r\n\t\t\t\tgameState,\r\n\t\t\t});\r\n\t\t}\r\n\t}\r\n\r\n\tconst entitiesThatWereReborn = performEntitySpawns(\r\n\t\tentitiesFromReborn,\r\n\t\tboardWithKilledMinion,\r\n\t\tboardWithKilledMinionHero,\r\n\t\tdeadEntity,\r\n\t\tdeadMinionIndexFromRight,\r\n\t\topponentBoard,\r\n\t\topponentBoardHero,\r\n\t\tgameState,\r\n\t);\r\n\tentitiesThatWereReborn.forEach((e) => (e.rebornFromEntityId = deadEntity.entityId));\r\n\tconst entityRightToSpawns =\r\n\t\tdeadMinionIndexFromRight === 0\r\n\t\t\t? null\r\n\t\t\t: boardWithKilledMinion[boardWithKilledMinion.length - deadMinionIndexFromRight];\r\n\tentitiesThatWereReborn.forEach((entity) => {\r\n\t\tentity.hasAttacked = deadEntity.hasAttacked > 1 ? 1 : entityRightToSpawns?.hasAttacked ?? undefined;\r\n\t});\r\n\r\n\tfor (const entity of boardWithKilledMinion) {\r\n\t\tconst rebornImpl = cardMappings[entity.cardId];\r\n\t\tif (hasAfterReborn(rebornImpl)) {\r\n\t\t\trebornImpl.afterReborn(entity, {\r\n\t\t\t\trebornEntity: deadEntity,\r\n\t\t\t\tboardWithKilledMinion,\r\n\t\t\t\tboardWithKilledMinionHero,\r\n\t\t\t\topponentBoard,\r\n\t\t\t\topponentBoardHero,\r\n\t\t\t\tgameState,\r\n\t\t\t});\r\n\t\t}\r\n\t}\r\n\tfor (const trinket of boardWithKilledMinionHero.trinkets ?? []) {\r\n\t\tconst rebornImpl = cardMappings[trinket.cardId];\r\n\t\tif (hasAfterReborn(rebornImpl)) {\r\n\t\t\trebornImpl.afterReborn(trinket, {\r\n\t\t\t\trebornEntity: deadEntity,\r\n\t\t\t\tboardWithKilledMinion,\r\n\t\t\t\tboardWithKilledMinionHero,\r\n\t\t\t\topponentBoard,\r\n\t\t\t\topponentBoardHero,\r\n\t\t\t\tgameState,\r\n\t\t\t});\r\n\t\t}\r\n\t}\r\n\r\n\t// Arfus\r\n\tboardWithKilledMinion\r\n\t\t.filter(\r\n\t\t\t(e) =>\r\n\t\t\t\te.cardId === CardIds.Arfus_TB_BaconShop_HERO_22_Buddy ||\r\n\t\t\t\te.cardId === CardIds.Arfus_TB_BaconShop_HERO_22_Buddy_G,\r\n\t\t)\r\n\t\t.forEach((arfus) => {\r\n\t\t\tconst multiplier = arfus.cardId === CardIds.Arfus_TB_BaconShop_HERO_22_Buddy_G ? 2 : 1;\r\n\t\t\tconst attackBonus = arfus.attack * multiplier;\r\n\t\t\tentitiesThatWereReborn\r\n\t\t\t\t.filter((e) => e.entityId !== arfus.entityId && e.rebornFromEntityId !== arfus.entityId)\r\n\t\t\t\t.forEach((e) => {\r\n\t\t\t\t\tmodifyStats(e, arfus, attackBonus, 0, boardWithKilledMinion, boardWithKilledMinionHero, gameState);\r\n\t\t\t\t});\r\n\t\t});\r\n\r\n\tconst numberOfTriggersForDeathwhisper = Math.min(entitiesThatWereReborn.length, 1);\r\n\tfor (let i = 0; i < numberOfTriggersForDeathwhisper; i++) {\r\n\t\tboardWithKilledMinion\r\n\t\t\t.filter(\r\n\t\t\t\t(e) =>\r\n\t\t\t\t\te.cardId === CardIds.SisterDeathwhisper_BG25_020 ||\r\n\t\t\t\t\te.cardId === CardIds.SisterDeathwhisper_BG25_020_G,\r\n\t\t\t)\r\n\t\t\t.forEach((e) => {\r\n\t\t\t\tconst multiplier = e.cardId === CardIds.SisterDeathwhisper_BG25_020_G ? 2 : 1;\r\n\t\t\t\taddStatsToBoard(\r\n\t\t\t\t\te,\r\n\t\t\t\t\tboardWithKilledMinion,\r\n\t\t\t\t\tboardWithKilledMinionHero,\r\n\t\t\t\t\tmultiplier * 1,\r\n\t\t\t\t\tmultiplier * 3,\r\n\t\t\t\t\tgameState,\r\n\t\t\t\t);\r\n\t\t\t});\r\n\t}\r\n};\r\n\r\nexport interface RebornEffectInput {\r\n\treadonly rebornEntity: BoardEntity;\r\n\treadonly boardWithKilledMinion: BoardEntity[];\r\n\treadonly boardWithKilledMinionHero: BgsPlayerEntity;\r\n\treadonly opponentBoard: BoardEntity[];\r\n\treadonly opponentBoardHero: BgsPlayerEntity;\r\n\treadonly gameState: FullGameState;\r\n}\r\n"]}
1
+ {"version":3,"file":"reborn.js","sourceRoot":"","sources":["../../src/simulation/reborn.ts"],"names":[],"mappings":";;;AAEA,4DAA+F;AAC/F,iEAA4D;AAC5D,8EAA+G;AAE/G,oCAA2C;AAC3C,6DAAqD;AAErD,qCAA+C;AAC/C,mCAAsC;AAE/B,MAAM,qBAAqB,GAAG,CACpC,qBAAoC,EACpC,yBAA0C,EAC1C,UAAuB,EACvB,wBAAgC,EAChC,aAA4B,EAC5B,iBAAkC,EAClC,SAAwB,EACjB,EAAE;;IACT,MAAM,eAAe,GAAG,CAAC,CAAC;IAC1B,IAAI,aAAa,GAAgB,IAAI,CAAC;IACtC,IACC,IAAA,sCAAkB,EAAC,UAAU,CAAC,MAAM,CAAC;SACrC,MAAA,UAAU,CAAC,YAAY,0CAAE,IAAI,CAC5B,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,wBAAuE,CACtF,CAAA,EACA;QACD,aAAa,GAAG,IAAA,qDAAiC,EAAC,UAAU,CAAC,CAAC;KAC9D;IACD,MAAM,kBAAkB,GACvB,UAAU,CAAC,MAAM,IAAI,wBAAwB,IAAI,CA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AE,CAAC,EAAE,EAAE;QACzD,qBAAqB;aACnB,MAAM,CACN,CAAC,CAAC,EAAE,EAAE,CACL,CAAC,CAAC,MAAM,eAAwC;YAChD,CAAC,CAAC,MAAM,iBAA0C,CACnD;aACA,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE;YACd,MAAM,UAAU,GAAG,CAAC,CAAC,MAAM,iBAA0C,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YAC9E,IAAA,uBAAe,EACd,CAAC,EACD,qBAAqB,EACrB,yBAAyB,EACzB,UAAU,GAAG,CAAC,EACd,UAAU,GAAG,CAAC,EACd,SAAS,CACT,CAAC;QACH,CAAC,CAAC,CAAC;KACJ;AACF,CAAC,CAAC;AAtKW,QAAA,qBAAqB,yBAsKhC","sourcesContent":["import { BgsPlayerEntity } from '../bgs-player-entity';\r\nimport { BoardEntity } from '../board-entity';\r\nimport { hasAfterReborn, hasRebornEffect, hasRebornSelfEffect } from '../cards/card.interface';\r\nimport { cardMappings } from '../cards/impl/_card-mappings';\r\nimport { buildSinrunnerBlanchyRebornEntity, isSinrunnerBlanchy } from '../cards/impl/minion/sinrunner-blanchy';\r\nimport { CardIds } from '../services/card-ids';\r\nimport { addStatsToBoard } from '../utils';\r\nimport { spawnEntities } from './deathrattle-spawns';\r\nimport { FullGameState } from './internal-game-state';\r\nimport { performEntitySpawns } from './spawns';\r\nimport { modifyStats } from './stats';\r\n\r\nexport const handleRebornForEntity = (\r\n\tboardWithKilledMinion: BoardEntity[],\r\n\tboardWithKilledMinionHero: BgsPlayerEntity,\r\n\tdeadEntity: BoardEntity,\r\n\tdeadMinionIndexFromRight: number,\r\n\topponentBoard: BoardEntity[],\r\n\topponentBoardHero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\tconst numberOfReborns = 1;\r\n\tlet entityToSpawn: BoardEntity = null;\r\n\tif (\r\n\t\tisSinrunnerBlanchy(deadEntity.cardId) ||\r\n\t\tdeadEntity.enchantments?.some(\r\n\t\t\t(e) => e.cardId === CardIds.UltraCapacitor_UltraCapacitorEnchantment_BG31_HERO_801ptje,\r\n\t\t)\r\n\t) {\r\n\t\tentityToSpawn = buildSinrunnerBlanchyRebornEntity(deadEntity);\r\n\t}\r\n\tconst entitiesFromReborn: readonly BoardEntity[] =\r\n\t\tdeadEntity.reborn && deadMinionIndexFromRight >= 0\r\n\t\t\t? spawnEntities(\r\n\t\t\t\t\tdeadEntity.cardId,\r\n\t\t\t\t\tnumberOfReborns,\r\n\t\t\t\t\tboardWithKilledMinion,\r\n\t\t\t\t\tboardWithKilledMinionHero,\r\n\t\t\t\t\topponentBoard,\r\n\t\t\t\t\topponentBoardHero,\r\n\t\t\t\t\tgameState,\r\n\t\t\t\t\tdeadEntity.friendly,\r\n\t\t\t\t\tfalse,\r\n\t\t\t\t\ttrue,\r\n\t\t\t\t\ttrue,\r\n\t\t\t\t\tentityToSpawn,\r\n\t\t\t\t\tdeadEntity,\r\n\t\t\t )\r\n\t\t\t: [];\r\n\tif (!entitiesFromReborn.length) {\r\n\t\treturn;\r\n\t}\r\n\r\n\tif (\r\n\t\tdeadEntity.cardId === CardIds.WannabeGargoyle_BG30_109 ||\r\n\t\tdeadEntity.cardId === CardIds.WannabeGargoyle_BG30_109_G\r\n\t) {\r\n\t\tentitiesFromReborn.forEach((e) => {\r\n\t\t\tconst attack = deadEntity.maxAttack;\r\n\t\t\tconst health = deadEntity.cardId === CardIds.WannabeGargoyle_BG30_109_G ? deadEntity.maxHealth : 1;\r\n\t\t\te.attack = attack;\r\n\t\t\te.health = health;\r\n\t\t});\r\n\t}\r\n\r\n\tfor (const entity of entitiesFromReborn) {\r\n\t\tconst rebornImpl = cardMappings[entity.cardId];\r\n\t\tif (hasRebornSelfEffect(rebornImpl)) {\r\n\t\t\trebornImpl.rebornSelfEffect(entity, {\r\n\t\t\t\trebornEntity: deadEntity,\r\n\t\t\t\tboardWithKilledMinion,\r\n\t\t\t\tboardWithKilledMinionHero,\r\n\t\t\t\topponentBoard,\r\n\t\t\t\topponentBoardHero,\r\n\t\t\t\tgameState,\r\n\t\t\t});\r\n\t\t}\r\n\t}\r\n\r\n\tfor (const entity of boardWithKilledMinion) {\r\n\t\tconst rebornImpl = cardMappings[entity.cardId];\r\n\t\tif (hasRebornEffect(rebornImpl)) {\r\n\t\t\trebornImpl.rebornEffect(entity, {\r\n\t\t\t\trebornEntity: deadEntity,\r\n\t\t\t\tboardWithKilledMinion,\r\n\t\t\t\tboardWithKilledMinionHero,\r\n\t\t\t\topponentBoard,\r\n\t\t\t\topponentBoardHero,\r\n\t\t\t\tgameState,\r\n\t\t\t});\r\n\t\t}\r\n\t}\r\n\r\n\tconst entitiesThatWereReborn = performEntitySpawns(\r\n\t\tentitiesFromReborn,\r\n\t\tboardWithKilledMinion,\r\n\t\tboardWithKilledMinionHero,\r\n\t\tdeadEntity,\r\n\t\tdeadMinionIndexFromRight,\r\n\t\topponentBoard,\r\n\t\topponentBoardHero,\r\n\t\tgameState,\r\n\t);\r\n\tentitiesThatWereReborn.forEach((e) => (e.rebornFromEntityId = deadEntity.entityId));\r\n\tconst entityRightToSpawns =\r\n\t\tdeadMinionIndexFromRight === 0\r\n\t\t\t? null\r\n\t\t\t: boardWithKilledMinion[boardWithKilledMinion.length - deadMinionIndexFromRight];\r\n\tentitiesThatWereReborn.forEach((entity) => {\r\n\t\tentity.hasAttacked = deadEntity.hasAttacked > 1 ? 1 : entityRightToSpawns?.hasAttacked ?? undefined;\r\n\t});\r\n\r\n\tfor (const rebornEntity of entitiesThatWereReborn) {\r\n\t\tfor (const entity of boardWithKilledMinion) {\r\n\t\t\tconst rebornImpl = cardMappings[entity.cardId];\r\n\t\t\tif (hasAfterReborn(rebornImpl)) {\r\n\t\t\t\trebornImpl.afterReborn(entity, {\r\n\t\t\t\t\trebornEntity: rebornEntity,\r\n\t\t\t\t\tboardWithKilledMinion,\r\n\t\t\t\t\tboardWithKilledMinionHero,\r\n\t\t\t\t\topponentBoard,\r\n\t\t\t\t\topponentBoardHero,\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\tfor (const trinket of boardWithKilledMinionHero.trinkets ?? []) {\r\n\t\t\tconst rebornImpl = cardMappings[trinket.cardId];\r\n\t\t\tif (hasAfterReborn(rebornImpl)) {\r\n\t\t\t\trebornImpl.afterReborn(trinket, {\r\n\t\t\t\t\trebornEntity: rebornEntity,\r\n\t\t\t\t\tboardWithKilledMinion,\r\n\t\t\t\t\tboardWithKilledMinionHero,\r\n\t\t\t\t\topponentBoard,\r\n\t\t\t\t\topponentBoardHero,\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\t// Arfus\r\n\tboardWithKilledMinion\r\n\t\t.filter(\r\n\t\t\t(e) =>\r\n\t\t\t\te.cardId === CardIds.Arfus_TB_BaconShop_HERO_22_Buddy ||\r\n\t\t\t\te.cardId === CardIds.Arfus_TB_BaconShop_HERO_22_Buddy_G,\r\n\t\t)\r\n\t\t.forEach((arfus) => {\r\n\t\t\tconst multiplier = arfus.cardId === CardIds.Arfus_TB_BaconShop_HERO_22_Buddy_G ? 2 : 1;\r\n\t\t\tconst attackBonus = arfus.attack * multiplier;\r\n\t\t\tentitiesThatWereReborn\r\n\t\t\t\t.filter((e) => e.entityId !== arfus.entityId && e.rebornFromEntityId !== arfus.entityId)\r\n\t\t\t\t.forEach((e) => {\r\n\t\t\t\t\tmodifyStats(e, arfus, attackBonus, 0, boardWithKilledMinion, boardWithKilledMinionHero, gameState);\r\n\t\t\t\t});\r\n\t\t});\r\n\r\n\tconst numberOfTriggersForDeathwhisper = Math.min(entitiesThatWereReborn.length, 1);\r\n\tfor (let i = 0; i < numberOfTriggersForDeathwhisper; i++) {\r\n\t\tboardWithKilledMinion\r\n\t\t\t.filter(\r\n\t\t\t\t(e) =>\r\n\t\t\t\t\te.cardId === CardIds.SisterDeathwhisper_BG25_020 ||\r\n\t\t\t\t\te.cardId === CardIds.SisterDeathwhisper_BG25_020_G,\r\n\t\t\t)\r\n\t\t\t.forEach((e) => {\r\n\t\t\t\tconst multiplier = e.cardId === CardIds.SisterDeathwhisper_BG25_020_G ? 2 : 1;\r\n\t\t\t\taddStatsToBoard(\r\n\t\t\t\t\te,\r\n\t\t\t\t\tboardWithKilledMinion,\r\n\t\t\t\t\tboardWithKilledMinionHero,\r\n\t\t\t\t\tmultiplier * 1,\r\n\t\t\t\t\tmultiplier * 3,\r\n\t\t\t\t\tgameState,\r\n\t\t\t\t);\r\n\t\t\t});\r\n\t}\r\n};\r\n\r\nexport interface RebornEffectInput {\r\n\treadonly rebornEntity: BoardEntity;\r\n\treadonly boardWithKilledMinion: BoardEntity[];\r\n\treadonly boardWithKilledMinionHero: BgsPlayerEntity;\r\n\treadonly opponentBoard: BoardEntity[];\r\n\treadonly opponentBoardHero: BgsPlayerEntity;\r\n\treadonly gameState: FullGameState;\r\n}\r\n"]}
@@ -66,7 +66,7 @@ const handleStartOfCombatTrinketsForPlayer = (input) => {
66
66
  : 1;
67
67
  for (let i = 0; i < loops; i++) {
68
68
  for (const trinket of input.playerEntity.trinkets) {
69
- (0, soc_action_processor_1.performStartOfCombatAction)(trinket.cardId, trinket, input, false);
69
+ (0, soc_action_processor_1.performStartOfCombatAction)(trinket.cardId, trinket, input, true);
70
70
  }
71
71
  }
72
72
  return input.currentAttacker;
@@ -1 +1 @@
1
- {"version":3,"file":"soc-trinket.js","sourceRoot":"","sources":["../../../src/simulation/start-of-combat/soc-trinket.ts"],"names":[],"mappings":";;;AAIA,4DAA8D;AAC9D,iEAAoE;AAG7D,MAAM,2BAA2B,GAAG,CAC1C,YAA6B,EAC7B,WAA0B,EAC1B,cAA+B,EAC/B,aAA4B,EAC5B,eAAuB,EACvB,SAAwB,EACf,EAAE;IACX,IAAI,IAAI,CAAC,MAAM,EAAE,GAAG,GAAG,EAAE;QACxB,eAAe,GAAG,oCAAoC,CAAC;YACtD,Y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AEF,MAAM,oCAAoC,GAAG,CAAC,KAAe,EAAU,EAAE;;IACxE,IAAI,KAAK,CAAC,YAAY,CAAC,iBAAiB,EAAE;QACzC,OAAO,KAAK,CAAC,eAAe,CAAC;KAC7B;IAED,MAAM,KAAK,GAAG,CAAA,MAAA,KAAK,CAAC,YAAY,CAAC,QAAQ,0CAAE,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,yBAAoD,CAAC;QACnH,CAAC,CAAC,CAAC;QACH,CAAC,CAAC,CAAC,CAAC;IACL,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,EAAE,CAAC,EAAE,EAAE;QAC/B,KAAK,MAAM,OAAO,IAAI,KAAK,CAAC,YAAY,CAAC,QAAQ,EAAE;YAClD,IAAA,iDAA0B,EAAC,OAAO,CAAC,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;SAClE;KACD;IAED,OAAO,KAAK,CAAC,eAAe,CAAC;AAC9B,CAAC,CAAC","sourcesContent":["import { BgsPlayerEntity } from '../../bgs-player-entity';\r\nimport { BoardEntity } from '../../board-entity';\r\nimport { CardIds } from '../../services/card-ids';\r\nimport { FullGameState } from '../internal-game-state';\r\nimport { handleSummonsWhenSpace } from '../summon-when-space';\r\nimport { performStartOfCombatAction } from './soc-action-processor';\r\nimport { SoCInput } from './start-of-combat-input';\r\n\r\nexport const handleStartOfCombatTrinkets = (\r\n\tplayerEntity: BgsPlayerEntity,\r\n\tplayerBoard: BoardEntity[],\r\n\topponentEntity: BgsPlayerEntity,\r\n\topponentBoard: BoardEntity[],\r\n\tcurrentAttacker: number,\r\n\tgameState: FullGameState,\r\n): number => {\r\n\tif (Math.random() < 0.5) {\r\n\t\tcurrentAttacker = handleStartOfCombatTrinketsForPlayer({\r\n\t\t\tplayerEntity: playerEntity,\r\n\t\t\tplayerBoard: playerBoard,\r\n\t\t\topponentEntity: opponentEntity,\r\n\t\t\topponentBoard: opponentBoard,\r\n\t\t\tcurrentAttacker,\r\n\t\t\tgameState,\r\n\t\t\tplayerIsFriendly: true,\r\n\t\t});\r\n\t\tcurrentAttacker = handleStartOfCombatTrinketsForPlayer({\r\n\t\t\tplayerEntity: opponentEntity,\r\n\t\t\tplayerBoard: opponentBoard,\r\n\t\t\topponentEntity: playerEntity,\r\n\t\t\topponentBoard: playerBoard,\r\n\t\t\tcurrentAttacker,\r\n\t\t\tgameState,\r\n\t\t\tplayerIsFriendly: false,\r\n\t\t});\r\n\t} else {\r\n\t\tcurrentAttacker = handleStartOfCombatTrinketsForPlayer({\r\n\t\t\tplayerEntity: opponentEntity,\r\n\t\t\tplayerBoard: opponentBoard,\r\n\t\t\topponentEntity: playerEntity,\r\n\t\t\topponentBoard: playerBoard,\r\n\t\t\tcurrentAttacker,\r\n\t\t\tgameState,\r\n\t\t\tplayerIsFriendly: false,\r\n\t\t});\r\n\t\tcurrentAttacker = handleStartOfCombatTrinketsForPlayer({\r\n\t\t\tplayerEntity: playerEntity,\r\n\t\t\tplayerBoard: playerBoard,\r\n\t\t\topponentEntity: opponentEntity,\r\n\t\t\topponentBoard: opponentBoard,\r\n\t\t\tcurrentAttacker,\r\n\t\t\tgameState,\r\n\t\t\tplayerIsFriendly: true,\r\n\t\t});\r\n\t}\r\n\tconst shouldRecomputeCurrentAttacker = handleSummonsWhenSpace(\r\n\t\tplayerBoard,\r\n\t\tplayerEntity,\r\n\t\topponentBoard,\r\n\t\topponentEntity,\r\n\t\tgameState,\r\n\t);\r\n\tif (shouldRecomputeCurrentAttacker) {\r\n\t\tcurrentAttacker =\r\n\t\t\tplayerBoard.length > opponentBoard.length\r\n\t\t\t\t? 0\r\n\t\t\t\t: opponentBoard.length > playerBoard.length\r\n\t\t\t\t? 1\r\n\t\t\t\t: Math.round(Math.random());\r\n\t}\r\n\treturn currentAttacker;\r\n};\r\n\r\nconst handleStartOfCombatTrinketsForPlayer = (input: SoCInput): number => {\r\n\tif (input.playerEntity.startOfCombatDone) {\r\n\t\treturn input.currentAttacker;\r\n\t}\r\n\r\n\tconst loops = input.playerEntity.trinkets?.some((t) => t.cardId === CardIds.ValdrakkenWindChimes_BG32_MagicItem_365)\r\n\t\t? 2\r\n\t\t: 1;\r\n\tfor (let i = 0; i < loops; i++) {\r\n\t\tfor (const trinket of input.playerEntity.trinkets) {\r\n\t\t\tperformStartOfCombatAction(trinket.cardId, trinket, input, false);\r\n\t\t}\r\n\t}\r\n\r\n\treturn input.currentAttacker;\r\n};\r\n"]}
1
+ {"version":3,"file":"soc-trinket.js","sourceRoot":"","sources":["../../../src/simulation/start-of-combat/soc-trinket.ts"],"names":[],"mappings":";;;AAIA,4DAA8D;AAC9D,iEAAoE;AAG7D,MAAM,2BAA2B,GAAG,CAC1C,YAA6B,EAC7B,WAA0B,EAC1B,cAA+B,EAC/B,aAA4B,EAC5B,eAAuB,EACvB,SAAwB,EACf,EAAE;IACX,IAAI,IAAI,CAAC,MAAM,EAAE,GAAG,GAAG,EAAE;QACxB,eAAe,GAAG,oCAAoC,CAAC;YACtD,YAAY,EAAE,YAAY;YAC1B,WAAW,EAAE,WAAW;YACxB,cAAc,EAAE,cAAc;YAC9B,aAAa,EAAE,aAAa;YAC5B,eAAe;YACf,SAAS;YACT,gBAAgB,EAAE,IAAI;SACtB,CAAC,CAAC;QACH,eAAe,GAAG,oCAAoC,CAAC;YACtD,YAAY,EAAE,cAAc;YAC5B,WAAW,EAAE,aAAa;YAC1B,cAAc,EAAE,YAAY;YAC5B,aAAa,EAAE,WAAW;YAC1B,eAAe;YACf,SAAS;YACT,gBAAgB,EAAE,KAAK;SACvB,CAAC,CAAC;KACH;SAAM;QACN,eAAe,GAAG,oCAAoC,CAAC;YACtD,YAAY,EAAE,cAAc;YAC5B,WAAW,EAAE,aAAa;YAC1B,cAAc,EAAE,YAAY;YAC5B,aAAa,EAAE,WAAW;YAC1B,eAAe;YACf,SAAS;YACT,gBAAgB,EAAE,KAAK;SACvB,CAAC,CAAC;QACH,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,IAAI,CAAC,CAAC;SACjE;KACD;IAED,OAAO,KAAK,CAAC,eAAe,CAAC;AAC9B,CAAC,CAAC","sourcesContent":["import { BgsPlayerEntity } from '../../bgs-player-entity';\r\nimport { BoardEntity } from '../../board-entity';\r\nimport { CardIds } from '../../services/card-ids';\r\nimport { FullGameState } from '../internal-game-state';\r\nimport { handleSummonsWhenSpace } from '../summon-when-space';\r\nimport { performStartOfCombatAction } from './soc-action-processor';\r\nimport { SoCInput } from './start-of-combat-input';\r\n\r\nexport const handleStartOfCombatTrinkets = (\r\n\tplayerEntity: BgsPlayerEntity,\r\n\tplayerBoard: BoardEntity[],\r\n\topponentEntity: BgsPlayerEntity,\r\n\topponentBoard: BoardEntity[],\r\n\tcurrentAttacker: number,\r\n\tgameState: FullGameState,\r\n): number => {\r\n\tif (Math.random() < 0.5) {\r\n\t\tcurrentAttacker = handleStartOfCombatTrinketsForPlayer({\r\n\t\t\tplayerEntity: playerEntity,\r\n\t\t\tplayerBoard: playerBoard,\r\n\t\t\topponentEntity: opponentEntity,\r\n\t\t\topponentBoard: opponentBoard,\r\n\t\t\tcurrentAttacker,\r\n\t\t\tgameState,\r\n\t\t\tplayerIsFriendly: true,\r\n\t\t});\r\n\t\tcurrentAttacker = handleStartOfCombatTrinketsForPlayer({\r\n\t\t\tplayerEntity: opponentEntity,\r\n\t\t\tplayerBoard: opponentBoard,\r\n\t\t\topponentEntity: playerEntity,\r\n\t\t\topponentBoard: playerBoard,\r\n\t\t\tcurrentAttacker,\r\n\t\t\tgameState,\r\n\t\t\tplayerIsFriendly: false,\r\n\t\t});\r\n\t} else {\r\n\t\tcurrentAttacker = handleStartOfCombatTrinketsForPlayer({\r\n\t\t\tplayerEntity: opponentEntity,\r\n\t\t\tplayerBoard: opponentBoard,\r\n\t\t\topponentEntity: playerEntity,\r\n\t\t\topponentBoard: playerBoard,\r\n\t\t\tcurrentAttacker,\r\n\t\t\tgameState,\r\n\t\t\tplayerIsFriendly: false,\r\n\t\t});\r\n\t\tcurrentAttacker = handleStartOfCombatTrinketsForPlayer({\r\n\t\t\tplayerEntity: playerEntity,\r\n\t\t\tplayerBoard: playerBoard,\r\n\t\t\topponentEntity: opponentEntity,\r\n\t\t\topponentBoard: opponentBoard,\r\n\t\t\tcurrentAttacker,\r\n\t\t\tgameState,\r\n\t\t\tplayerIsFriendly: true,\r\n\t\t});\r\n\t}\r\n\tconst shouldRecomputeCurrentAttacker = handleSummonsWhenSpace(\r\n\t\tplayerBoard,\r\n\t\tplayerEntity,\r\n\t\topponentBoard,\r\n\t\topponentEntity,\r\n\t\tgameState,\r\n\t);\r\n\tif (shouldRecomputeCurrentAttacker) {\r\n\t\tcurrentAttacker =\r\n\t\t\tplayerBoard.length > opponentBoard.length\r\n\t\t\t\t? 0\r\n\t\t\t\t: opponentBoard.length > playerBoard.length\r\n\t\t\t\t? 1\r\n\t\t\t\t: Math.round(Math.random());\r\n\t}\r\n\treturn currentAttacker;\r\n};\r\n\r\nconst handleStartOfCombatTrinketsForPlayer = (input: SoCInput): number => {\r\n\tif (input.playerEntity.startOfCombatDone) {\r\n\t\treturn input.currentAttacker;\r\n\t}\r\n\r\n\tconst loops = input.playerEntity.trinkets?.some((t) => t.cardId === CardIds.ValdrakkenWindChimes_BG32_MagicItem_365)\r\n\t\t? 2\r\n\t\t: 1;\r\n\tfor (let i = 0; i < loops; i++) {\r\n\t\tfor (const trinket of input.playerEntity.trinkets) {\r\n\t\t\t// 2026-06-02: https://replays.firestoneapp.com/?reviewId=71a20859-0e12-4c71-a5c9-51fa10c39294&turn=23&action=5\r\n\t\t\t// Soul Fermenter triggers, minions die, new minions spawn, then Baleful Incense triggers\r\n\t\t\tperformStartOfCombatAction(trinket.cardId, trinket, input, true);\r\n\t\t}\r\n\t}\r\n\r\n\treturn input.currentAttacker;\r\n};\r\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@firestone-hs/simulate-bgs-battle",
3
- "version": "1.1.716",
3
+ "version": "1.1.717",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "lint": "eslint --color --fix --ext .ts .",