@firestone-hs/simulate-bgs-battle 1.1.557 → 1.1.559

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.
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.LightningInvocation = void 0;
4
4
  const deathrattle_effects_1 = require("../../../simulation/deathrattle-effects");
5
5
  exports.LightningInvocation = {
6
- startOfCombatTiming: 'pre-combat',
6
+ startOfCombatTiming: 'start-of-combat',
7
7
  cardIds: ["BG22_HERO_001p_t4", "BG22_HERO_001p_t4_s"],
8
8
  startOfCombat: (trinket, input) => {
9
9
  for (const heroPower of input.playerEntity.heroPowers) {
@@ -1 +1 @@
1
- {"version":3,"file":"lightning-invocation.js","sourceRoot":"","sources":["../../../../src/cards/impl/hero-power/lightning-invocation.ts"],"names":[],"mappings":";;;AAEA,iFAA8F;AAIjF,QAAA,mBAAmB,GAAsB;IACrD,mBAAmB,EAAE,YAAY;IACjC,OAAO,EAAE,4CAA+D;IACxE,aAAa,EAAE,CAAC,OAAqB,EAAE,KAAe,EAAE,EAAE;QACzD,KAAK,MAAM,SAAS,IAAI,KAAK,CAAC,YAAY,CAAC,UAAU,EAAE;YACtD,IAAI,2BAAmB,CAAC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,SAAS,CAAC,IAAI,EAAE;gBAC7E,IAAA,yDAAmC,EAClC,KAAK,CAAC,WAAW,EACjB,KAAK,CAAC,YAAY,EAClB,IAAI,EACJ,KAAK,CAAC,aAAa,EACnB,KAAK,CAAC,cAAc,EACpB,KAAK,CAAC,SAAS,CACf,CAAC;gBACF,OAAO,IAAI,CAAC;aACZ;SACD;IACF,CAAC;CACD,CAAC","sourcesContent":["import { CardIds } from '@firestone-hs/reference-data';\r\nimport { BoardTrinket } from '../../../bgs-player-entity';\r\nimport { applyLightningInvocationEnchantment } from '../../../simulation/deathrattle-effects';\r\nimport { SoCInput } from '../../../simulation/start-of-combat/start-of-combat-input';\r\nimport { StartOfCombatCard } from '../../card.interface';\r\n\r\nexport const LightningInvocation: StartOfCombatCard = {\r\n\tstartOfCombatTiming: 'pre-combat',\r\n\tcardIds: [CardIds.LightningInvocationToken, CardIds.LightningInvocation],\r\n\tstartOfCombat: (trinket: BoardTrinket, input: SoCInput) => {\r\n\t\tfor (const heroPower of input.playerEntity.heroPowers) {\r\n\t\t\tif (LightningInvocation.cardIds.includes(heroPower.cardId) && heroPower.used) {\r\n\t\t\t\tapplyLightningInvocationEnchantment(\r\n\t\t\t\t\tinput.playerBoard,\r\n\t\t\t\t\tinput.playerEntity,\r\n\t\t\t\t\tnull,\r\n\t\t\t\t\tinput.opponentBoard,\r\n\t\t\t\t\tinput.opponentEntity,\r\n\t\t\t\t\tinput.gameState,\r\n\t\t\t\t);\r\n\t\t\t\treturn true;\r\n\t\t\t}\r\n\t\t}\r\n\t},\r\n};\r\n"]}
1
+ {"version":3,"file":"lightning-invocation.js","sourceRoot":"","sources":["../../../../src/cards/impl/hero-power/lightning-invocation.ts"],"names":[],"mappings":";;;AAEA,iFAA8F;AAIjF,QAAA,mBAAmB,GAAsB;IACrD,mBAAmB,EAAE,iBAAiB;IACtC,OAAO,EAAE,4CAA+D;IACxE,aAAa,EAAE,CAAC,OAAqB,EAAE,KAAe,EAAE,EAAE;QACzD,KAAK,MAAM,SAAS,IAAI,KAAK,CAAC,YAAY,CAAC,UAAU,EAAE;YACtD,IAAI,2BAAmB,CAAC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,SAAS,CAAC,IAAI,EAAE;gBAC7E,IAAA,yDAAmC,EAClC,KAAK,CAAC,WAAW,EACjB,KAAK,CAAC,YAAY,EAClB,IAAI,EACJ,KAAK,CAAC,aAAa,EACnB,KAAK,CAAC,cAAc,EACpB,KAAK,CAAC,SAAS,CACf,CAAC;gBACF,OAAO,IAAI,CAAC;aACZ;SACD;IACF,CAAC;CACD,CAAC","sourcesContent":["import { CardIds } from '@firestone-hs/reference-data';\r\nimport { BoardTrinket } from '../../../bgs-player-entity';\r\nimport { applyLightningInvocationEnchantment } from '../../../simulation/deathrattle-effects';\r\nimport { SoCInput } from '../../../simulation/start-of-combat/start-of-combat-input';\r\nimport { StartOfCombatCard } from '../../card.interface';\r\n\r\nexport const LightningInvocation: StartOfCombatCard = {\r\n\tstartOfCombatTiming: 'start-of-combat',\r\n\tcardIds: [CardIds.LightningInvocationToken, CardIds.LightningInvocation],\r\n\tstartOfCombat: (trinket: BoardTrinket, input: SoCInput) => {\r\n\t\tfor (const heroPower of input.playerEntity.heroPowers) {\r\n\t\t\tif (LightningInvocation.cardIds.includes(heroPower.cardId) && heroPower.used) {\r\n\t\t\t\tapplyLightningInvocationEnchantment(\r\n\t\t\t\t\tinput.playerBoard,\r\n\t\t\t\t\tinput.playerEntity,\r\n\t\t\t\t\tnull,\r\n\t\t\t\t\tinput.opponentBoard,\r\n\t\t\t\t\tinput.opponentEntity,\r\n\t\t\t\t\tinput.gameState,\r\n\t\t\t\t);\r\n\t\t\t\treturn true;\r\n\t\t\t}\r\n\t\t}\r\n\t},\r\n};\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"reborn-rites.js","sourceRoot":"","sources":["../../../../src/cards/impl/hero-power/reborn-rites.ts"],"names":[],"mappings":";;;AAEA,qDAAwD;AAI3C,QAAA,WAAW,GAAsB;IAC7C,mBAAmB,EAAE,YAAY;IACjC,OAAO,EAAE,uBAAqB;IAC9B,aAAa,EAAE,CAAC,OAAqB,EAAE,KAAe,EAAE,EAAE;QACzD,KAAK,MAAM,SAAS,IAAI,KAAK,CAAC,YAAY,CAAC,UAAU,EAAE;YACtD,IAAI,mBAAW,CAAC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,SAAS,CAAC,IAAI,EAAE;gBACrE,MAAM,cAAc,GAAG,SAAS,CAAC,IAAc,CAAC;gBAChD,MAAM,MAAM,GAAG,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,QAAQ,KAAK,cAAc,CAAC,CAAC;gBACtF,IAAI,CAAC,MAAM,IAAI,MAAM,CAAC,MAAM,EAAE;oBAC7B,OAAO,KAAK,CAAC;iBACb;gBAED,IAAA,qBAAY,EACX,MAAM,EACN,IAAI,EACJ,KAAK,CAAC,WAAW,EACjB,KAAK,CAAC,YAAY,EAClB,KAAK,CAAC,cAAc,EACpB,KAAK,CAAC,SAAS,CACf,CAAC;gBACF,KAAK,CAAC,SAAS,CAAC,SAAS,CAAC,mBAAmB,CAC5C,KAAK,CAAC,YAAY,EAClB,MAAM,EACN,KAAK,CAAC,WAAW,EACjB,KAAK,CAAC,YAAY,EAClB,KAAK,CAAC,cAAc,CACpB,CAAC;gBACF,OAAO,IAAI,CAAC;aACZ;SACD;IACF,CAAC;CACD,CAAC","sourcesContent":["import { CardIds } from '@firestone-hs/reference-data';\r\nimport { BoardTrinket } from '../../../bgs-player-entity';\r\nimport { updateReborn } from '../../../keywords/reborn';\r\nimport { SoCInput } from '../../../simulation/start-of-combat/start-of-combat-input';\r\nimport { StartOfCombatCard } from '../../card.interface';\r\n\r\nexport const RebornRites: StartOfCombatCard = {\r\n\tstartOfCombatTiming: 'pre-combat',\r\n\tcardIds: [CardIds.RebornRites],\r\n\tstartOfCombat: (trinket: BoardTrinket, input: SoCInput) => {\r\n\t\tfor (const heroPower of input.playerEntity.heroPowers) {\r\n\t\t\tif (RebornRites.cardIds.includes(heroPower.cardId) && heroPower.used) {\r\n\t\t\t\tconst targetEntityId = heroPower.info as number;\r\n\t\t\t\tconst target = input.playerBoard.find((entity) => entity.entityId === targetEntityId);\r\n\t\t\t\tif (!target || target.reborn) {\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t}\r\n\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.playerBoard,\r\n\t\t\t\t\tinput.playerEntity,\r\n\t\t\t\t\tinput.opponentEntity,\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\tinput.playerEntity,\r\n\t\t\t\t\ttarget,\r\n\t\t\t\t\tinput.playerBoard,\r\n\t\t\t\t\tinput.playerEntity,\r\n\t\t\t\t\tinput.opponentEntity,\r\n\t\t\t\t);\r\n\t\t\t\treturn true;\r\n\t\t\t}\r\n\t\t}\r\n\t},\r\n};\r\n"]}
1
+ {"version":3,"file":"reborn-rites.js","sourceRoot":"","sources":["../../../../src/cards/impl/hero-power/reborn-rites.ts"],"names":[],"mappings":";;;AAEA,qDAAwD;AAI3C,QAAA,WAAW,GAAsB;IAE7C,mBAAmB,EAAE,YAAY;IACjC,OAAO,EAAE,uBAAqB;IAC9B,aAAa,EAAE,CAAC,OAAqB,EAAE,KAAe,EAAE,EAAE;QACzD,KAAK,MAAM,SAAS,IAAI,KAAK,CAAC,YAAY,CAAC,UAAU,EAAE;YACtD,IAAI,mBAAW,CAAC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,SAAS,CAAC,IAAI,EAAE;gBACrE,MAAM,cAAc,GAAG,SAAS,CAAC,IAAc,CAAC;gBAChD,MAAM,MAAM,GAAG,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,QAAQ,KAAK,cAAc,CAAC,CAAC;gBACtF,IAAI,CAAC,MAAM,IAAI,MAAM,CAAC,MAAM,EAAE;oBAC7B,OAAO,KAAK,CAAC;iBACb;gBAED,IAAA,qBAAY,EACX,MAAM,EACN,IAAI,EACJ,KAAK,CAAC,WAAW,EACjB,KAAK,CAAC,YAAY,EAClB,KAAK,CAAC,cAAc,EACpB,KAAK,CAAC,SAAS,CACf,CAAC;gBACF,KAAK,CAAC,SAAS,CAAC,SAAS,CAAC,mBAAmB,CAC5C,KAAK,CAAC,YAAY,EAClB,MAAM,EACN,KAAK,CAAC,WAAW,EACjB,KAAK,CAAC,YAAY,EAClB,KAAK,CAAC,cAAc,CACpB,CAAC;gBACF,OAAO,IAAI,CAAC;aACZ;SACD;IACF,CAAC;CACD,CAAC","sourcesContent":["import { CardIds } from '@firestone-hs/reference-data';\r\nimport { BoardTrinket } from '../../../bgs-player-entity';\r\nimport { updateReborn } from '../../../keywords/reborn';\r\nimport { SoCInput } from '../../../simulation/start-of-combat/start-of-combat-input';\r\nimport { StartOfCombatCard } from '../../card.interface';\r\n\r\nexport const RebornRites: StartOfCombatCard = {\r\n\t// Confirmed to be pre-combat on 2024-03-06\r\n\tstartOfCombatTiming: 'pre-combat',\r\n\tcardIds: [CardIds.RebornRites],\r\n\tstartOfCombat: (trinket: BoardTrinket, input: SoCInput) => {\r\n\t\tfor (const heroPower of input.playerEntity.heroPowers) {\r\n\t\t\tif (RebornRites.cardIds.includes(heroPower.cardId) && heroPower.used) {\r\n\t\t\t\tconst targetEntityId = heroPower.info as number;\r\n\t\t\t\tconst target = input.playerBoard.find((entity) => entity.entityId === targetEntityId);\r\n\t\t\t\tif (!target || target.reborn) {\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t}\r\n\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.playerBoard,\r\n\t\t\t\t\tinput.playerEntity,\r\n\t\t\t\t\tinput.opponentEntity,\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\tinput.playerEntity,\r\n\t\t\t\t\ttarget,\r\n\t\t\t\t\tinput.playerBoard,\r\n\t\t\t\t\tinput.playerEntity,\r\n\t\t\t\t\tinput.opponentEntity,\r\n\t\t\t\t);\r\n\t\t\t\treturn true;\r\n\t\t\t}\r\n\t\t}\r\n\t},\r\n};\r\n"]}
@@ -17,13 +17,14 @@ exports.DeathlyStriker = {
17
17
  for (const card of addedCards) {
18
18
  card.locked = false;
19
19
  card.lastAffectedByEntity = minion;
20
+ input.gameState.spectator.registerPowerTarget(minion, card, input.board, input.hero, input.otherHero);
20
21
  }
21
22
  },
22
23
  deathrattleSpawn: (minion, input) => {
23
24
  const targets = input.boardWithDeadEntityHero.hand.filter((e) => { var _a; return !e.locked && ((_a = e.lastAffectedByEntity) === null || _a === void 0 ? void 0 : _a.entityId) === minion.entityId; });
24
25
  const spawned = [];
25
26
  for (const target of targets) {
26
- spawned.push(...(0, deathrattle_spawns_1.simplifiedSpawnEntities)(target.cardId, 1, input, { ...target }));
27
+ spawned.push(...(0, deathrattle_spawns_1.simplifiedSpawnEntities)(target.cardId, 1, input));
27
28
  target.locked = true;
28
29
  }
29
30
  return spawned;
@@ -1 +1 @@
1
- {"version":3,"file":"deathly-striker.js","sourceRoot":"","sources":["../../../../src/cards/impl/minion/deathly-striker.ts"],"names":[],"mappings":";;;AAAA,iEAA6D;AAG7D,qEAAmE;AAEnE,+EAAiF;AAGpE,QAAA,cAAc,GAAsC;IAChE,OAAO,EAAE,0BAAoE;IAC7E,eAAe,EAAE,CAAC,MAAc,EAAE,EAAE,CAAC,CAAC;IACtC,MAAM,EAAE,CAAC,MAAmB,EAAE,KAAkB,EAAE,EAAE;QACnD,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,eAAoC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACvE,MAAM,KAAK,GAAG,EAAE,CAAC;QACjB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC,EAAE,EAAE;YAC9B,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,SAAS,CAAC,uBAAuB,CAAC,qBAAI,CAAC,MAAM,EAAE,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC;SAClG;QACD,MAAM,UAAU,GAAG,IAAA,8BAAc,EAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;QACnF,KAAK,MAAM,IAAI,IAAI,UAAU,EAAE;YAC9B,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;YACpB,IAAI,CAAC,oBAAoB,GAAG,MAAM,CAAC;SACnC;IACF,CAAC;IACD,gBAAgB,EAAE,CAAC,MAAmB,EAAE,KAAgC,EAA0B,EAAE;QACnG,MAAM,OAAO,GAAG,KAAK,CAAC,uBAAuB,CAAC,IAAI,CAAC,MAAM,CACxD,CAAC,CAAC,EAAE,EAAE,WAAC,OAAA,CAAC,CAAC,CAAC,MAAM,IAAI,CAAA,MAAA,CAAC,CAAC,oBAAoB,0CAAE,QAAQ,MAAK,MAAM,CAAC,QAAQ,CAAA,EAAA,CACxE,CAAC;QACF,MAAM,OAAO,GAAkB,EAAE,CAAC;QAClC,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE;YAC7B,OAAO,CAAC,IAAI,CAAC,GAAG,IAAA,4CAAuB,EAAC,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE,GAAG,MAAM,EAAE,CAAC,CAAC,CAAC;YACjF,MAAM,CAAC,MAAM,GAAG,IAAI,CAAC;SACrB;QACD,OAAO,OAAO,CAAC;IAChB,CAAC;CACD,CAAC","sourcesContent":["import { CardIds, Race } from '@firestone-hs/reference-data';\r\nimport { BoardEntity } from '../../../board-entity';\r\nimport { AvengeInput } from '../../../simulation/avenge';\r\nimport { addCardsInHand } from '../../../simulation/cards-in-hand';\r\nimport { DeathrattleTriggeredInput } from '../../../simulation/deathrattle-on-trigger';\r\nimport { simplifiedSpawnEntities } from '../../../simulation/deathrattle-spawns';\r\nimport { AvengeCard, DeathrattleSpawnCard } from '../../card.interface';\r\n\r\nexport const DeathlyStriker: AvengeCard & DeathrattleSpawnCard = {\r\n\tcardIds: [CardIds.DeathlyStriker_BG31_835, CardIds.DeathlyStriker_BG31_835_G],\r\n\tbaseAvengeValue: (cardId: string) => 4,\r\n\tavenge: (minion: BoardEntity, input: AvengeInput) => {\r\n\t\tconst mult = minion.cardId === CardIds.DeathlyStriker_BG31_835 ? 1 : 2;\r\n\t\tconst cards = [];\r\n\t\tfor (let i = 0; i < mult; i++) {\r\n\t\t\tcards.push(input.gameState.cardsData.getRandomMinionForTribe(Race.UNDEAD, input.hero.tavernTier));\r\n\t\t}\r\n\t\tconst addedCards = addCardsInHand(input.hero, input.board, cards, input.gameState);\r\n\t\tfor (const card of addedCards) {\r\n\t\t\tcard.locked = false;\r\n\t\t\tcard.lastAffectedByEntity = minion;\r\n\t\t}\r\n\t},\r\n\tdeathrattleSpawn: (minion: BoardEntity, input: DeathrattleTriggeredInput): readonly BoardEntity[] => {\r\n\t\tconst targets = input.boardWithDeadEntityHero.hand.filter(\r\n\t\t\t(e) => !e.locked && e.lastAffectedByEntity?.entityId === minion.entityId,\r\n\t\t);\r\n\t\tconst spawned: BoardEntity[] = [];\r\n\t\tfor (const target of targets) {\r\n\t\t\tspawned.push(...simplifiedSpawnEntities(target.cardId, 1, input, { ...target }));\r\n\t\t\ttarget.locked = true;\r\n\t\t}\r\n\t\treturn spawned;\r\n\t},\r\n};\r\n"]}
1
+ {"version":3,"file":"deathly-striker.js","sourceRoot":"","sources":["../../../../src/cards/impl/minion/deathly-striker.ts"],"names":[],"mappings":";;;AAAA,iEAA6D;AAG7D,qEAAmE;AAEnE,+EAAiF;AAGpE,QAAA,cAAc,GAAsC;IAChE,OAAO,EAAE,0BAAoE;IAC7E,eAAe,EAAE,CAAC,MAAc,EAAE,EAAE,CAAC,CAAC;IACtC,MAAM,EAAE,CAAC,MAAmB,EAAE,KAAkB,EAAE,EAAE;QACnD,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,eAAoC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACvE,MAAM,KAAK,GAAa,EAAE,CAAC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AAO,OAAO,CAAC;IAChB,CAAC;CACD,CAAC","sourcesContent":["import { CardIds, Race } from '@firestone-hs/reference-data';\r\nimport { BoardEntity } from '../../../board-entity';\r\nimport { AvengeInput } from '../../../simulation/avenge';\r\nimport { addCardsInHand } from '../../../simulation/cards-in-hand';\r\nimport { DeathrattleTriggeredInput } from '../../../simulation/deathrattle-on-trigger';\r\nimport { simplifiedSpawnEntities } from '../../../simulation/deathrattle-spawns';\r\nimport { AvengeCard, DeathrattleSpawnCard } from '../../card.interface';\r\n\r\nexport const DeathlyStriker: AvengeCard & DeathrattleSpawnCard = {\r\n\tcardIds: [CardIds.DeathlyStriker_BG31_835, CardIds.DeathlyStriker_BG31_835_G],\r\n\tbaseAvengeValue: (cardId: string) => 4,\r\n\tavenge: (minion: BoardEntity, input: AvengeInput) => {\r\n\t\tconst mult = minion.cardId === CardIds.DeathlyStriker_BG31_835 ? 1 : 2;\r\n\t\tconst cards: string[] = [];\r\n\t\tfor (let i = 0; i < mult; i++) {\r\n\t\t\tcards.push(input.gameState.cardsData.getRandomMinionForTribe(Race.UNDEAD, input.hero.tavernTier));\r\n\t\t}\r\n\t\tconst addedCards = addCardsInHand(input.hero, input.board, cards, input.gameState);\r\n\t\tfor (const card of addedCards) {\r\n\t\t\tcard.locked = false;\r\n\t\t\tcard.lastAffectedByEntity = minion;\r\n\t\t\tinput.gameState.spectator.registerPowerTarget(minion, card, input.board, input.hero, input.otherHero);\r\n\t\t}\r\n\t},\r\n\tdeathrattleSpawn: (minion: BoardEntity, input: DeathrattleTriggeredInput): readonly BoardEntity[] => {\r\n\t\tconst targets = input.boardWithDeadEntityHero.hand.filter(\r\n\t\t\t(e) => !e.locked && e.lastAffectedByEntity?.entityId === minion.entityId,\r\n\t\t);\r\n\t\tconst spawned: BoardEntity[] = [];\r\n\t\tfor (const target of targets) {\r\n\t\t\tspawned.push(...simplifiedSpawnEntities(target.cardId, 1, input));\r\n\t\t\ttarget.locked = true;\r\n\t\t}\r\n\t\treturn spawned;\r\n\t},\r\n};\r\n"]}
@@ -10,7 +10,7 @@ exports.FountainChiller = {
10
10
  cardIds: ["BG31_145", "BG31_145_G"],
11
11
  battlecry: (minion, input) => {
12
12
  const mult = minion.cardId === "BG31_145_G" ? 2 : 1;
13
- let totalKeywords = 0;
13
+ let totalKeywords = 1;
14
14
  for (const bonusKeyword of cards_data_1.validBonusKeywords) {
15
15
  if (input.board.some((e) => (0, cards_data_1.hasKeyword)(e, bonusKeyword))) {
16
16
  totalKeywords++;
@@ -19,7 +19,7 @@ exports.FountainChiller = {
19
19
  const candidates = input.board.filter((e) => (0, utils_2.hasCorrectTribe)(e, input.hero, reference_data_1.Race.MURLOC, input.gameState.anomalies, input.gameState.allCards));
20
20
  const target = (0, utils_1.pickRandom)(candidates);
21
21
  if (!!target) {
22
- (0, stats_1.modifyStats)(target, totalKeywords * mult, totalKeywords * mult, input.board, input.hero, input.gameState);
22
+ (0, stats_1.modifyStats)(target, 2 * totalKeywords * mult, totalKeywords * mult, input.board, input.hero, input.gameState);
23
23
  input.gameState.spectator.registerPowerTarget(minion, target, input.board, input.hero, input.otherHero);
24
24
  }
25
25
  },
@@ -1 +1 @@
1
- {"version":3,"file":"fountain-chiller.js","sourceRoot":"","sources":["../../../../src/cards/impl/minion/fountain-chiller.ts"],"names":[],"mappings":";;;AAAA,iEAA6D;AAE7D,mDAAqD;AAErD,qDAAwD;AACxD,0CAAiD;AAEjD,iDAAkE;AAErD,QAAA,eAAe,GAAkB;IAC7C,OAAO,EAAE,0BAAsE;IAC/E,SAAS,EAAE,CAAC,MAAmB,EAAE,KAAqB,EAAE,EAAE;QACzD,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,iBAAuC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAC1E,IAAI,aAAa,GAAG,CAAC,CAAC;QACtB,KAAK,MAAM,YAAY,IAAI,+BAAkB,EAAE;YAC9C,IAAI,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAA,uBAAU,EAAC,CAAC,EAAE,YAAY,CAAC,CAAC,EAAE;gBACzD,aAAa,EAAE,CAAC;aAChB;SACD;QACD,MAAM,UAAU,GAAG,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAC3C,IAAA,uBAAe,EAAC,CAAC,EAAE,KAAK,CAAC,IAAI,EAAE,qBAAI,CAAC,MAAM,EAAE,KAAK,CAAC,SAAS,CAAC,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC,QAAQ,CAAC,CAChG,CAAC;QACF,MAAM,MAAM,GAAG,IAAA,kBAAU,EAAC,UAAU,CAAC,CAAC;QACtC,IAAI,CAAC,CAAC,MAAM,EAAE;YACb,IAAA,mBAAW,EAAC,MAAM,EAAE,aAAa,GAAG,IAAI,EAAE,aAAa,GAAG,IAAI,EAAE,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;YAC1G,KAAK,CAAC,SAAS,CAAC,SAAS,CAAC,mBAAmB,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;SACxG;IACF,CAAC;CACD,CAAC","sourcesContent":["import { CardIds, Race } from '@firestone-hs/reference-data';\r\nimport { BoardEntity } from '../../../board-entity';\r\nimport { pickRandom } from '../../../services/utils';\r\nimport { BattlecryInput } from '../../../simulation/battlecries';\r\nimport { modifyStats } from '../../../simulation/stats';\r\nimport { hasCorrectTribe } from '../../../utils';\r\nimport { BattlecryCard } from '../../card.interface';\r\nimport { hasKeyword, validBonusKeywords } from '../../cards-data';\r\n\r\nexport const FountainChiller: BattlecryCard = {\r\n\tcardIds: [CardIds.FountainChiller_BG31_145, CardIds.FountainChiller_BG31_145_G],\r\n\tbattlecry: (minion: BoardEntity, input: BattlecryInput) => {\r\n\t\tconst mult = minion.cardId === CardIds.FountainChiller_BG31_145_G ? 2 : 1;\r\n\t\tlet totalKeywords = 0;\r\n\t\tfor (const bonusKeyword of validBonusKeywords) {\r\n\t\t\tif (input.board.some((e) => hasKeyword(e, bonusKeyword))) {\r\n\t\t\t\ttotalKeywords++;\r\n\t\t\t}\r\n\t\t}\r\n\t\tconst candidates = input.board.filter((e) =>\r\n\t\t\thasCorrectTribe(e, input.hero, Race.MURLOC, input.gameState.anomalies, input.gameState.allCards),\r\n\t\t);\r\n\t\tconst target = pickRandom(candidates);\r\n\t\tif (!!target) {\r\n\t\t\tmodifyStats(target, totalKeywords * mult, totalKeywords * mult, input.board, input.hero, input.gameState);\r\n\t\t\tinput.gameState.spectator.registerPowerTarget(minion, target, input.board, input.hero, input.otherHero);\r\n\t\t}\r\n\t},\r\n};\r\n"]}
1
+ {"version":3,"file":"fountain-chiller.js","sourceRoot":"","sources":["../../../../src/cards/impl/minion/fountain-chiller.ts"],"names":[],"mappings":";;;AAAA,iEAA6D;AAE7D,mDAAqD;AAErD,qDAAwD;AACxD,0CAAiD;AAEjD,iDAAkE;AAErD,QAAA,eAAe,GAAkB;IAC7C,OAAO,EAAE,0BAAsE;IAC/E,SAAS,EAAE,CAAC,MAAmB,EAAE,KAAqB,EAAE,EAAE;QACzD,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,iBAAuC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAC1E,IAAI,aAAa,GAAG,CAAC,CAAC;QACtB,KAAK,MAAM,YAAY,IAAI,+BAAkB,EAAE;YAC9C,IAAI,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAA,uBAAU,EAAC,CAAC,EAAE,YAAY,CAAC,CAAC,EAAE;gBACzD,aAAa,EAAE,CAAC;aAChB;SACD;QACD,MAAM,UAAU,GAAG,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAC3C,IAAA,uBAAe,EAAC,CAAC,EAAE,KAAK,CAAC,IAAI,EAAE,qBAAI,CAAC,MAAM,EAAE,KAAK,CAAC,SAAS,CAAC,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC,QAAQ,CAAC,CAChG,CAAC;QACF,MAAM,MAAM,GAAG,IAAA,kBAAU,EAAC,UAAU,CAAC,CAAC;QACtC,IAAI,CAAC,CAAC,MAAM,EAAE;YACb,IAAA,mBAAW,EACV,MAAM,EACN,CAAC,GAAG,aAAa,GAAG,IAAI,EACxB,aAAa,GAAG,IAAI,EACpB,KAAK,CAAC,KAAK,EACX,KAAK,CAAC,IAAI,EACV,KAAK,CAAC,SAAS,CACf,CAAC;YACF,KAAK,CAAC,SAAS,CAAC,SAAS,CAAC,mBAAmB,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;SACxG;IACF,CAAC;CACD,CAAC","sourcesContent":["import { CardIds, Race } from '@firestone-hs/reference-data';\r\nimport { BoardEntity } from '../../../board-entity';\r\nimport { pickRandom } from '../../../services/utils';\r\nimport { BattlecryInput } from '../../../simulation/battlecries';\r\nimport { modifyStats } from '../../../simulation/stats';\r\nimport { hasCorrectTribe } from '../../../utils';\r\nimport { BattlecryCard } from '../../card.interface';\r\nimport { hasKeyword, validBonusKeywords } from '../../cards-data';\r\n\r\nexport const FountainChiller: BattlecryCard = {\r\n\tcardIds: [CardIds.FountainChiller_BG31_145, CardIds.FountainChiller_BG31_145_G],\r\n\tbattlecry: (minion: BoardEntity, input: BattlecryInput) => {\r\n\t\tconst mult = minion.cardId === CardIds.FountainChiller_BG31_145_G ? 2 : 1;\r\n\t\tlet totalKeywords = 1; // Base is 1, even without other keywords\r\n\t\tfor (const bonusKeyword of validBonusKeywords) {\r\n\t\t\tif (input.board.some((e) => hasKeyword(e, bonusKeyword))) {\r\n\t\t\t\ttotalKeywords++;\r\n\t\t\t}\r\n\t\t}\r\n\t\tconst candidates = input.board.filter((e) =>\r\n\t\t\thasCorrectTribe(e, input.hero, Race.MURLOC, input.gameState.anomalies, input.gameState.allCards),\r\n\t\t);\r\n\t\tconst target = pickRandom(candidates);\r\n\t\tif (!!target) {\r\n\t\t\tmodifyStats(\r\n\t\t\t\ttarget,\r\n\t\t\t\t2 * totalKeywords * mult,\r\n\t\t\t\ttotalKeywords * mult,\r\n\t\t\t\tinput.board,\r\n\t\t\t\tinput.hero,\r\n\t\t\t\tinput.gameState,\r\n\t\t\t);\r\n\t\t\tinput.gameState.spectator.registerPowerTarget(minion, target, input.board, input.hero, input.otherHero);\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.ShipInABottle = void 0;
4
4
  const utils_1 = require("../../../services/utils");
5
+ const attack_1 = require("../../../simulation/attack");
5
6
  const cards_in_hand_1 = require("../../../simulation/cards-in-hand");
6
7
  const deathrattle_spawns_1 = require("../../../simulation/deathrattle-spawns");
7
8
  const spawns_1 = require("../../../simulation/spawns");
@@ -13,6 +14,9 @@ exports.ShipInABottle = {
13
14
  const newMinions = (0, deathrattle_spawns_1.spawnEntities)(target, 1, input.playerBoard, input.playerEntity, input.opponentBoard, input.opponentEntity, input.gameState, input.playerEntity.friendly, false);
14
15
  const spawns = (0, spawns_1.performEntitySpawns)(newMinions, input.playerBoard, input.playerEntity, input.playerEntity, 0, input.opponentBoard, input.opponentEntity, input.gameState);
15
16
  spawns.forEach((spawn) => (spawn.attackImmediately = true));
17
+ for (const spawn of spawns) {
18
+ (0, attack_1.simulateAttack)(input.playerBoard, input.playerEntity, input.opponentBoard, input.opponentEntity, input.gameState);
19
+ }
16
20
  return true;
17
21
  }
18
22
  },
@@ -1 +1 @@
1
- {"version":3,"file":"ship-in-a-bottle.js","sourceRoot":"","sources":["../../../../src/cards/impl/trinket/ship-in-a-bottle.ts"],"names":[],"mappings":";;;AACA,mDAAqD;AACrD,qEAAmE;AACnE,+EAAuE;AACvE,uDAAiE;AAGpD,QAAA,aAAa,GAAG;IAC5B,aAAa,EAAE,CAAC,OAAqB,EAAE,KAAe,EAAE,EAAE;QACzD,IAAI,KAAK,CAAC,WAAW,CAAC,MAAM,GAAG,CAAC,EAAE;YACjC,MAAM,MAAM,GAAG,IAAA,kBAAU,EAAC,KAAK,CAAC,SAAS,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC;YAClE,IAAA,8BAAc,EAAC,KAAK,CAAC,YAAY,EAAE,KAAK,CAAC,WAAW,EAAE,CAAC,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;YACjF,MAAM,UAAU,GAAG,IAAA,kCAAa,EAC/B,MAAM,EACN,CAAC,EACD,KAAK,CAAC,WAAW,EACjB,KAAK,CAAC,YAAY,EAClB,KAAK,CAAC,aAAa,EACnB,KAAK,CAAC,cAAc,EACpB,KAAK,CAAC,SAAS,EACf,KAAK,CAAC,YAAY,CAAC,QAAQ,EAC3B,KAAK,CACL,CAAC;YACF,MAAM,MAAM,GAAG,IAAA,4BAAmB,EACjC,UAAU,EACV,KAAK,CAAC,WAAW,EACjB,KAAK,CAAC,YAAY,EAClB,KAAK,CAAC,YAAY,EAClB,CAAC,EACD,KAAK,CAAC,aAAa,EACnB,KAAK,CAAC,cAAc,EACpB,KAAK,CAAC,SAAS,CACf,CAAC;YACF,MAAM,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,iBAAiB,GAAG,IAAI,CAAC,CAAC,CAAC;YAC5D,OAAO,IAAI,CAAC;SACZ;IACF,CAAC;CACD,CAAC","sourcesContent":["import { BoardTrinket } from '../../../bgs-player-entity';\r\nimport { pickRandom } from '../../../services/utils';\r\nimport { addCardsInHand } from '../../../simulation/cards-in-hand';\r\nimport { spawnEntities } from '../../../simulation/deathrattle-spawns';\r\nimport { performEntitySpawns } from '../../../simulation/spawns';\r\nimport { SoCInput } from '../../../simulation/start-of-combat/start-of-combat-input';\r\n\r\nexport const ShipInABottle = {\r\n\tstartOfCombat: (trinket: BoardTrinket, input: SoCInput) => {\r\n\t\tif (input.playerBoard.length < 7) {\r\n\t\t\tconst target = pickRandom(input.gameState.cardsData.pirateSpawns);\r\n\t\t\taddCardsInHand(input.playerEntity, input.playerBoard, [target], input.gameState);\r\n\t\t\tconst newMinions = spawnEntities(\r\n\t\t\t\ttarget,\r\n\t\t\t\t1,\r\n\t\t\t\tinput.playerBoard,\r\n\t\t\t\tinput.playerEntity,\r\n\t\t\t\tinput.opponentBoard,\r\n\t\t\t\tinput.opponentEntity,\r\n\t\t\t\tinput.gameState,\r\n\t\t\t\tinput.playerEntity.friendly,\r\n\t\t\t\tfalse,\r\n\t\t\t);\r\n\t\t\tconst spawns = performEntitySpawns(\r\n\t\t\t\tnewMinions,\r\n\t\t\t\tinput.playerBoard,\r\n\t\t\t\tinput.playerEntity,\r\n\t\t\t\tinput.playerEntity,\r\n\t\t\t\t0,\r\n\t\t\t\tinput.opponentBoard,\r\n\t\t\t\tinput.opponentEntity,\r\n\t\t\t\tinput.gameState,\r\n\t\t\t);\r\n\t\t\tspawns.forEach((spawn) => (spawn.attackImmediately = true));\r\n\t\t\treturn true;\r\n\t\t}\r\n\t},\r\n};\r\n"]}
1
+ {"version":3,"file":"ship-in-a-bottle.js","sourceRoot":"","sources":["../../../../src/cards/impl/trinket/ship-in-a-bottle.ts"],"names":[],"mappings":";;;AACA,mDAAqD;AACrD,uDAA4D;AAC5D,qEAAmE;AACnE,+EAAuE;AACvE,uDAAiE;AAGpD,QAAA,aAAa,GAAG;IAC5B,aAAa,EAAE,CAAC,OAAqB,EAAE,KAAe,EAAE,EAAE;QACzD,IAAI,KAAK,CAAC,WAAW,CAAC,MAAM,GAAG,CAAC,EAAE;YACjC,MAAM,MAAM,GAAG,IAAA,kBAAU,EAAC,KAAK,CAAC,SAAS,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC;YAClE,IAAA,8BAAc,EAAC,KAAK,CAAC,YAAY,EAAE,KAAK,CAAC,WAAW,EAAE,CAAC,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;YACjF,MAAM,UAAU,GAAG,IAAA,kCAAa,EAC/B,MAAM,EACN,CAAC,EACD,KAAK,CAAC,WAAW,EACjB,KAAK,CAAC,YAAY,EAClB,KAAK,CAAC,aAAa,EACnB,KAAK,CAAC,cAAc,EACpB,KAAK,CAAC,SAAS,EACf,KAAK,CAAC,YAAY,CAAC,QAAQ,EAC3B,KAAK,CACL,CAAC;YAEF,MAAM,MAAM,GAAG,IAAA,4BAAmB,EACjC,UAAU,EACV,KAAK,CAAC,WAAW,EACjB,KAAK,CAAC,YAAY,EAClB,KAAK,CAAC,YAAY,EAClB,CAAC,EACD,KAAK,CAAC,aAAa,EACnB,KAAK,CAAC,cAAc,EACpB,KAAK,CAAC,SAAS,CACf,CAAC;YACF,MAAM,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,iBAAiB,GAAG,IAAI,CAAC,CAAC,CAAC;YAE5D,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE;gBAC3B,IAAA,uBAAc,EACb,KAAK,CAAC,WAAW,EACjB,KAAK,CAAC,YAAY,EAClB,KAAK,CAAC,aAAa,EACnB,KAAK,CAAC,cAAc,EACpB,KAAK,CAAC,SAAS,CACf,CAAC;aACF;YAED,OAAO,IAAI,CAAC;SACZ;IACF,CAAC;CACD,CAAC","sourcesContent":["import { BoardTrinket } from '../../../bgs-player-entity';\r\nimport { pickRandom } from '../../../services/utils';\r\nimport { simulateAttack } from '../../../simulation/attack';\r\nimport { addCardsInHand } from '../../../simulation/cards-in-hand';\r\nimport { spawnEntities } from '../../../simulation/deathrattle-spawns';\r\nimport { performEntitySpawns } from '../../../simulation/spawns';\r\nimport { SoCInput } from '../../../simulation/start-of-combat/start-of-combat-input';\r\n\r\nexport const ShipInABottle = {\r\n\tstartOfCombat: (trinket: BoardTrinket, input: SoCInput) => {\r\n\t\tif (input.playerBoard.length < 7) {\r\n\t\t\tconst target = pickRandom(input.gameState.cardsData.pirateSpawns);\r\n\t\t\taddCardsInHand(input.playerEntity, input.playerBoard, [target], input.gameState);\r\n\t\t\tconst newMinions = spawnEntities(\r\n\t\t\t\ttarget,\r\n\t\t\t\t1,\r\n\t\t\t\tinput.playerBoard,\r\n\t\t\t\tinput.playerEntity,\r\n\t\t\t\tinput.opponentBoard,\r\n\t\t\t\tinput.opponentEntity,\r\n\t\t\t\tinput.gameState,\r\n\t\t\t\tinput.playerEntity.friendly,\r\n\t\t\t\tfalse,\r\n\t\t\t);\r\n\t\t\t// Don't set the attackImmediately here so the property is not copied by Bonerender\r\n\t\t\tconst spawns = performEntitySpawns(\r\n\t\t\t\tnewMinions,\r\n\t\t\t\tinput.playerBoard,\r\n\t\t\t\tinput.playerEntity,\r\n\t\t\t\tinput.playerEntity,\r\n\t\t\t\t0,\r\n\t\t\t\tinput.opponentBoard,\r\n\t\t\t\tinput.opponentEntity,\r\n\t\t\t\tinput.gameState,\r\n\t\t\t);\r\n\t\t\tspawns.forEach((spawn) => (spawn.attackImmediately = true));\r\n\t\t\t// This is a bit weird, but the spawn attacks before other start of combat triggers like Sky Pirate Flagbearer\r\n\t\t\tfor (const spawn of spawns) {\r\n\t\t\t\tsimulateAttack(\r\n\t\t\t\t\tinput.playerBoard,\r\n\t\t\t\t\tinput.playerEntity,\r\n\t\t\t\t\tinput.opponentBoard,\r\n\t\t\t\t\tinput.opponentEntity,\r\n\t\t\t\t\tinput.gameState,\r\n\t\t\t\t);\r\n\t\t\t}\r\n\r\n\t\t\treturn true;\r\n\t\t}\r\n\t},\r\n};\r\n"]}
@@ -84,7 +84,7 @@ const setMissingAura = (board, minionCardId, enchantmentCardId, attack, health,
84
84
  }
85
85
  };
86
86
  const setImplicitDataHero = (hero, cardsData, isPlayer, entityIdContainer) => {
87
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1;
87
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0;
88
88
  for (const heroPower of hero.heroPowers) {
89
89
  const avengeValue = cardsData.avengeValue(heroPower.cardId);
90
90
  if (avengeValue > 0) {
@@ -95,8 +95,8 @@ const setImplicitDataHero = (hero, cardsData, isPlayer, entityIdContainer) => {
95
95
  if (!!((_a = hero.questRewards) === null || _a === void 0 ? void 0 : _a.length) && !Array.isArray(hero.questRewards)) {
96
96
  hero.questRewards = [hero.questRewards];
97
97
  }
98
- const heroPowerAsReward = hero.cardId === "BG24_HERO_100" ? (_b = hero.heroPowers[0]) === null || _b === void 0 ? void 0 : _b.cardId : null;
99
- hero.questRewards = [...((_c = hero.questRewards) !== null && _c !== void 0 ? _c : []), heroPowerAsReward].filter((e) => !!e);
98
+ const heroPowerAsReward = null;
99
+ hero.questRewards = [...((_b = hero.questRewards) !== null && _b !== void 0 ? _b : []), heroPowerAsReward].filter((e) => !!e);
100
100
  hero.questRewardEntities = hero.questRewardEntities
101
101
  ? hero.questRewardEntities.map((reward) => {
102
102
  var _a;
@@ -115,38 +115,38 @@ const setImplicitDataHero = (hero, cardsData, isPlayer, entityIdContainer) => {
115
115
  avengeDefault: cardsData.avengeValue(reward),
116
116
  scriptDataNum1: cardsData.defaultScriptDataNum(reward),
117
117
  }));
118
- hero.trinkets = ((_d = hero.trinkets) !== null && _d !== void 0 ? _d : []).map((trinket) => ({
118
+ hero.trinkets = ((_c = hero.trinkets) !== null && _c !== void 0 ? _c : []).map((trinket) => ({
119
119
  ...trinket,
120
120
  avengeDefault: cardsData.avengeValue(trinket.cardId),
121
121
  avengeCurrent: cardsData.avengeValue(trinket.cardId),
122
122
  scriptDataNum1: cardsData.defaultScriptDataNum(trinket.cardId),
123
123
  }));
124
124
  hero.entityId = hero.entityId || entityIdContainer.entityId--;
125
- hero.hand = (_e = hero.hand) !== null && _e !== void 0 ? _e : [];
125
+ hero.hand = (_d = hero.hand) !== null && _d !== void 0 ? _d : [];
126
126
  if (!hero.globalInfo) {
127
127
  hero.globalInfo = {};
128
128
  }
129
- hero.globalInfo.EternalKnightsDeadThisGame = (_f = hero.globalInfo.EternalKnightsDeadThisGame) !== null && _f !== void 0 ? _f : 0;
130
- hero.globalInfo.SanlaynScribesDeadThisGame = (_g = hero.globalInfo.SanlaynScribesDeadThisGame) !== null && _g !== void 0 ? _g : 0;
131
- hero.globalInfo.BeastsSummonedThisGame = (_h = hero.globalInfo.BeastsSummonedThisGame) !== null && _h !== void 0 ? _h : 0;
132
- hero.globalInfo.MagnetizedThisGame = (_j = hero.globalInfo.MagnetizedThisGame) !== null && _j !== void 0 ? _j : 0;
133
- hero.globalInfo.PiratesSummonedThisGame = (_k = hero.globalInfo.PiratesSummonedThisGame) !== null && _k !== void 0 ? _k : 0;
134
- hero.globalInfo.BattlecriesTriggeredThisGame = (_l = hero.globalInfo.BattlecriesTriggeredThisGame) !== null && _l !== void 0 ? _l : 0;
135
- hero.globalInfo.BeetleAttackBuff = (_m = hero.globalInfo.BeetleAttackBuff) !== null && _m !== void 0 ? _m : 0;
136
- hero.globalInfo.BeetleHealthBuff = (_o = hero.globalInfo.BeetleHealthBuff) !== null && _o !== void 0 ? _o : 0;
137
- hero.globalInfo.MutatedLasherAttackBuff = (_p = hero.globalInfo.MutatedLasherAttackBuff) !== null && _p !== void 0 ? _p : 0;
138
- hero.globalInfo.MutatedLasherHealthBuff = (_q = hero.globalInfo.MutatedLasherHealthBuff) !== null && _q !== void 0 ? _q : 0;
139
- hero.globalInfo.TavernSpellsCastThisGame = (_r = hero.globalInfo.TavernSpellsCastThisGame) !== null && _r !== void 0 ? _r : 0;
140
- hero.globalInfo.UndeadAttackBonus = (_s = hero.globalInfo.UndeadAttackBonus) !== null && _s !== void 0 ? _s : 0;
141
- hero.globalInfo.FrostlingBonus = (_t = hero.globalInfo.FrostlingBonus) !== null && _t !== void 0 ? _t : 0;
129
+ hero.globalInfo.EternalKnightsDeadThisGame = (_e = hero.globalInfo.EternalKnightsDeadThisGame) !== null && _e !== void 0 ? _e : 0;
130
+ hero.globalInfo.SanlaynScribesDeadThisGame = (_f = hero.globalInfo.SanlaynScribesDeadThisGame) !== null && _f !== void 0 ? _f : 0;
131
+ hero.globalInfo.BeastsSummonedThisGame = (_g = hero.globalInfo.BeastsSummonedThisGame) !== null && _g !== void 0 ? _g : 0;
132
+ hero.globalInfo.MagnetizedThisGame = (_h = hero.globalInfo.MagnetizedThisGame) !== null && _h !== void 0 ? _h : 0;
133
+ hero.globalInfo.PiratesSummonedThisGame = (_j = hero.globalInfo.PiratesSummonedThisGame) !== null && _j !== void 0 ? _j : 0;
134
+ hero.globalInfo.BattlecriesTriggeredThisGame = (_k = hero.globalInfo.BattlecriesTriggeredThisGame) !== null && _k !== void 0 ? _k : 0;
135
+ hero.globalInfo.BeetleAttackBuff = (_l = hero.globalInfo.BeetleAttackBuff) !== null && _l !== void 0 ? _l : 0;
136
+ hero.globalInfo.BeetleHealthBuff = (_m = hero.globalInfo.BeetleHealthBuff) !== null && _m !== void 0 ? _m : 0;
137
+ hero.globalInfo.MutatedLasherAttackBuff = (_o = hero.globalInfo.MutatedLasherAttackBuff) !== null && _o !== void 0 ? _o : 0;
138
+ hero.globalInfo.MutatedLasherHealthBuff = (_p = hero.globalInfo.MutatedLasherHealthBuff) !== null && _p !== void 0 ? _p : 0;
139
+ hero.globalInfo.TavernSpellsCastThisGame = (_q = hero.globalInfo.TavernSpellsCastThisGame) !== null && _q !== void 0 ? _q : 0;
140
+ hero.globalInfo.UndeadAttackBonus = (_r = hero.globalInfo.UndeadAttackBonus) !== null && _r !== void 0 ? _r : 0;
141
+ hero.globalInfo.FrostlingBonus = (_s = hero.globalInfo.FrostlingBonus) !== null && _s !== void 0 ? _s : 0;
142
142
  hero.globalInfo.BloodGemAttackBonus =
143
- ((_u = hero.globalInfo.BloodGemAttackBonus) !== null && _u !== void 0 ? _u : 0) +
144
- ((_w = (_v = hero.questRewardEntities) === null || _v === void 0 ? void 0 : _v.filter((e) => e.cardId === "BG27_Reward_815").length) !== null && _w !== void 0 ? _w : 0);
143
+ ((_t = hero.globalInfo.BloodGemAttackBonus) !== null && _t !== void 0 ? _t : 0) +
144
+ ((_v = (_u = hero.questRewardEntities) === null || _u === void 0 ? void 0 : _u.filter((e) => e.cardId === "BG27_Reward_815").length) !== null && _v !== void 0 ? _v : 0);
145
145
  hero.globalInfo.BloodGemHealthBonus =
146
- ((_x = hero.globalInfo.BloodGemHealthBonus) !== null && _x !== void 0 ? _x : 0) +
147
- ((_z = (_y = hero.questRewardEntities) === null || _y === void 0 ? void 0 : _y.filter((e) => e.cardId === "BG27_Reward_815").length) !== null && _z !== void 0 ? _z : 0);
148
- hero.globalInfo.GoldrinnBuffAtk = (_0 = hero.globalInfo.GoldrinnBuffAtk) !== null && _0 !== void 0 ? _0 : 0;
149
- hero.globalInfo.GoldrinnBuffHealth = (_1 = hero.globalInfo.GoldrinnBuffHealth) !== null && _1 !== void 0 ? _1 : 0;
146
+ ((_w = hero.globalInfo.BloodGemHealthBonus) !== null && _w !== void 0 ? _w : 0) +
147
+ ((_y = (_x = hero.questRewardEntities) === null || _x === void 0 ? void 0 : _x.filter((e) => e.cardId === "BG27_Reward_815").length) !== null && _y !== void 0 ? _y : 0);
148
+ hero.globalInfo.GoldrinnBuffAtk = (_z = hero.globalInfo.GoldrinnBuffAtk) !== null && _z !== void 0 ? _z : 0;
149
+ hero.globalInfo.GoldrinnBuffHealth = (_0 = hero.globalInfo.GoldrinnBuffHealth) !== null && _0 !== void 0 ? _0 : 0;
150
150
  };
151
151
  exports.setImplicitDataHero = setImplicitDataHero;
152
152
  const clearStealthIfNeeded = (board, hero, otherBoard, otherHero, gameState) => {
@@ -1 +1 @@
1
- {"version":3,"file":"auras.js","sourceRoot":"","sources":["../../src/simulation/auras.ts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C,MAAM,GAAG,IAAI,CAAC;QACzC,KAAK,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,IAAI,CAAC;YAC1B,MAAM,EACL,CAAC,CAAC,MAAM,yBAAkD;gBACzD,CAAC;gBACD,CAAC,uBAA8E;YACjF,cAAc,EAAE,CAAC,CAAC,QAAQ;YAC1B,MAAM,EAAE,SAAS,CAAC,WAAW,CAAC,eAAe,EAAE;SAC/C,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AArDW,QAAA,oBAAoB,wBAqD/B","sourcesContent":["/* eslint-disable @typescript-eslint/no-use-before-define */\r\nimport { AllCardsService, CardIds, 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 { 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\tswitch (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\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_MrgglaarglEnchantment,\r\n\t\t4,\r\n\t\t0,\r\n\t);\r\n\tsetMissingAura(\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\tsetMissingAura(\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\tsetMissingAura(\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;\r\n\t\t\theroPower.avengeDefault = avengeValue;\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\tconst heroPowerAsReward = 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\tscriptDataNum1: 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\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.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.BeetleAttackBuff = hero.globalInfo.BeetleAttackBuff ?? 0;\r\n\thero.globalInfo.BeetleHealthBuff = hero.globalInfo.BeetleHealthBuff ?? 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.UndeadAttackBonus = hero.globalInfo.UndeadAttackBonus ?? 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};\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\r\nexport const updateBoardwideAuras = (\r\n\tboard: BoardEntity[],\r\n\tboardHero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\tif (board.length === 0) {\r\n\t\treturn;\r\n\t}\r\n\r\n\tboard\r\n\t\t.filter((entity) =>\r\n\t\t\tentity.enchantments.some(\r\n\t\t\t\t(ench) =>\r\n\t\t\t\t\tench.cardId === CardIds.WindrunnerNecklace_RunningLikeTheWindEnchantment_BG30_MagicItem_997e ||\r\n\t\t\t\t\tench.cardId === CardIds.WindrunnerNecklace_RunningLikeTheWindEnchantment_BG30_MagicItem_997e2,\r\n\t\t\t),\r\n\t\t)\r\n\t\t.forEach((e) => {\r\n\t\t\tconst enchantments = e.enchantments.filter(\r\n\t\t\t\t(ench) => ench.cardId === CardIds.WindrunnerNecklace_RunningLikeTheWindEnchantment_BG30_MagicItem_997e,\r\n\t\t\t).length;\r\n\t\t\tconst greaterEnchantments = e.enchantments.filter(\r\n\t\t\t\t(ench) => ench.cardId === CardIds.WindrunnerNecklace_RunningLikeTheWindEnchantment_BG30_MagicItem_997e2,\r\n\t\t\t).length;\r\n\t\t\te.attack = Math.max(0, e.attack - enchantments * 8 - greaterEnchantments * 15);\r\n\t\t\te.enchantments = e.enchantments\r\n\t\t\t\t.filter(\r\n\t\t\t\t\t(ench) =>\r\n\t\t\t\t\t\tench.cardId !== CardIds.WindrunnerNecklace_RunningLikeTheWindEnchantment_BG30_MagicItem_997e,\r\n\t\t\t\t)\r\n\t\t\t\t.filter(\r\n\t\t\t\t\t(ench) =>\r\n\t\t\t\t\t\tench.cardId !== CardIds.WindrunnerNecklace_RunningLikeTheWindEnchantment_BG30_MagicItem_997e2,\r\n\t\t\t\t);\r\n\t\t});\r\n\tboardHero.trinkets\r\n\t\t.filter(\r\n\t\t\t(t) =>\r\n\t\t\t\tt.cardId === CardIds.WindrunnerNecklace_BG30_MagicItem_997 ||\r\n\t\t\t\tt.cardId === CardIds.WindrunnerNecklace_WindrunnerNecklaceToken_BG30_MagicItem_997t,\r\n\t\t)\r\n\t\t.forEach((t) => {\r\n\t\t\tconst buff = t.cardId === CardIds.WindrunnerNecklace_BG30_MagicItem_997 ? 8 : 15;\r\n\t\t\tboard[0].attack = board[0].attack + buff;\r\n\t\t\tboard[0].enchantments.push({\r\n\t\t\t\tcardId:\r\n\t\t\t\t\tt.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\toriginEntityId: t.entityId,\r\n\t\t\t\ttiming: gameState.sharedState.currentEntityId++,\r\n\t\t\t});\r\n\t\t});\r\n};\r\n"]}
1
+ {"version":3,"file":"auras.js","sourceRoot":"","sources":["../../src/simulation/auras.ts"],"names":[],"mappings":";;;AACA,iEAA8E;AAI9E,iDAAoD;AACpD,oCAA2C;AAGpC,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;QAC/C,QAAQ,OAAO,CAAC,MAAM,EAAE;YACvB,0BAAmD;YACnD;gBACC,MAAM,WAAW,GAChB,OAAO,CAAC,MAAM,yBAAkD;oBAC/D,CAAC;oBACD,CAAC,uBAA8E,CAAC;gBAClF,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,yBAAkD,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;gBACvF,MAAM,MAAM,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;gBACxB,IAAI,CAAC,CAAC,MAA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C,MAAM,0BAA2E,CACpF;SACA,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE;QACd,MAAM,IAAI,GAAG,CAAC,CAAC,MAAM,yBAAkD,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QACjF,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,GAAG,IAAI,CAAC;QACzC,KAAK,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,IAAI,CAAC;YAC1B,MAAM,EACL,CAAC,CAAC,MAAM,yBAAkD;gBACzD,CAAC;gBACD,CAAC,uBAA8E;YACjF,cAAc,EAAE,CAAC,CAAC,QAAQ;YAC1B,MAAM,EAAE,SAAS,CAAC,WAAW,CAAC,eAAe,EAAE;SAC/C,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AArDW,QAAA,oBAAoB,wBAqD/B","sourcesContent":["/* eslint-disable @typescript-eslint/no-use-before-define */\r\nimport { AllCardsService, CardIds, 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 { 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\tswitch (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\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_MrgglaarglEnchantment,\r\n\t\t4,\r\n\t\t0,\r\n\t);\r\n\tsetMissingAura(\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\tsetMissingAura(\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\tsetMissingAura(\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;\r\n\t\t\theroPower.avengeDefault = avengeValue;\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\tscriptDataNum1: 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\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.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.BeetleAttackBuff = hero.globalInfo.BeetleAttackBuff ?? 0;\r\n\thero.globalInfo.BeetleHealthBuff = hero.globalInfo.BeetleHealthBuff ?? 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.UndeadAttackBonus = hero.globalInfo.UndeadAttackBonus ?? 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};\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\r\nexport const updateBoardwideAuras = (\r\n\tboard: BoardEntity[],\r\n\tboardHero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\tif (board.length === 0) {\r\n\t\treturn;\r\n\t}\r\n\r\n\tboard\r\n\t\t.filter((entity) =>\r\n\t\t\tentity.enchantments.some(\r\n\t\t\t\t(ench) =>\r\n\t\t\t\t\tench.cardId === CardIds.WindrunnerNecklace_RunningLikeTheWindEnchantment_BG30_MagicItem_997e ||\r\n\t\t\t\t\tench.cardId === CardIds.WindrunnerNecklace_RunningLikeTheWindEnchantment_BG30_MagicItem_997e2,\r\n\t\t\t),\r\n\t\t)\r\n\t\t.forEach((e) => {\r\n\t\t\tconst enchantments = e.enchantments.filter(\r\n\t\t\t\t(ench) => ench.cardId === CardIds.WindrunnerNecklace_RunningLikeTheWindEnchantment_BG30_MagicItem_997e,\r\n\t\t\t).length;\r\n\t\t\tconst greaterEnchantments = e.enchantments.filter(\r\n\t\t\t\t(ench) => ench.cardId === CardIds.WindrunnerNecklace_RunningLikeTheWindEnchantment_BG30_MagicItem_997e2,\r\n\t\t\t).length;\r\n\t\t\te.attack = Math.max(0, e.attack - enchantments * 8 - greaterEnchantments * 15);\r\n\t\t\te.enchantments = e.enchantments\r\n\t\t\t\t.filter(\r\n\t\t\t\t\t(ench) =>\r\n\t\t\t\t\t\tench.cardId !== CardIds.WindrunnerNecklace_RunningLikeTheWindEnchantment_BG30_MagicItem_997e,\r\n\t\t\t\t)\r\n\t\t\t\t.filter(\r\n\t\t\t\t\t(ench) =>\r\n\t\t\t\t\t\tench.cardId !== CardIds.WindrunnerNecklace_RunningLikeTheWindEnchantment_BG30_MagicItem_997e2,\r\n\t\t\t\t);\r\n\t\t});\r\n\tboardHero.trinkets\r\n\t\t.filter(\r\n\t\t\t(t) =>\r\n\t\t\t\tt.cardId === CardIds.WindrunnerNecklace_BG30_MagicItem_997 ||\r\n\t\t\t\tt.cardId === CardIds.WindrunnerNecklace_WindrunnerNecklaceToken_BG30_MagicItem_997t,\r\n\t\t)\r\n\t\t.forEach((t) => {\r\n\t\t\tconst buff = t.cardId === CardIds.WindrunnerNecklace_BG30_MagicItem_997 ? 8 : 15;\r\n\t\t\tboard[0].attack = board[0].attack + buff;\r\n\t\t\tboard[0].enchantments.push({\r\n\t\t\t\tcardId:\r\n\t\t\t\t\tt.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\toriginEntityId: t.entityId,\r\n\t\t\t\ttiming: gameState.sharedState.currentEntityId++,\r\n\t\t\t});\r\n\t\t});\r\n};\r\n"]}
@@ -25,7 +25,7 @@ const handlePlayerIllidanHeroPowers = (playerEntity, playerBoard, opponentEntity
25
25
  for (const heroPower of playerEntity.heroPowers) {
26
26
  if (heroPower.cardId === "TB_BaconShop_HP_069" && playerBoard.length > 0) {
27
27
  handleIllidanForPlayer(playerBoard, playerEntity, opponentBoard, opponentEntity, gameState, currentAttacker);
28
- currentAttacker = (currentAttacker + 1) % 2;
28
+ currentAttacker = Math.random() < 0.5 ? 0 : 1;
29
29
  }
30
30
  }
31
31
  return currentAttacker;
@@ -1 +1 @@
1
- {"version":3,"file":"soc-illidan-hero-power.js","sourceRoot":"","sources":["../../../src/simulation/start-of-combat/soc-illidan-hero-power.ts"],"names":[],"mappings":";;;AAGA,sCAA+D;AAE/D,oCAAuC;AACvC,4DAA8D;AAEvD,MAAM,uBAAuB,GAAG,CACtC,YAA6B,EAC7B,WAA0B,EAC1B,cAA+B,EAC/B,aAA4B,EAC5B,eAAuB,EACvB,SAAwB,EACf,EAAE;IA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GAAG,CAAC,CAAC;IAC9B,IAAI,CAAC,CAAC,cAAc,IAAI,CAAC,cAAc,CAAC,cAAc,IAAI,cAAc,CAAC,MAAM,GAAG,CAAC,EAAE;QACpF,cAAc,CAAC,iBAAiB,GAAG,IAAI,CAAC;QACxC,IAAA,uBAAc,EAAC,WAAW,EAAE,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,SAAS,CAAC,CAAC;QACpF,cAAc,CAAC,WAAW,GAAG,CAAC,CAAC;KAC/B;AAOF,CAAC,CAAC","sourcesContent":["import { CardIds } from '@firestone-hs/reference-data';\r\nimport { BgsPlayerEntity } from '../../bgs-player-entity';\r\nimport { BoardEntity } from '../../board-entity';\r\nimport { processMinionDeath, simulateAttack } from '../attack';\r\nimport { FullGameState } from '../internal-game-state';\r\nimport { modifyStats } from '../stats';\r\nimport { handleSummonsWhenSpace } from '../summon-when-space';\r\n\r\nexport const handleIllidanHeroPowers = (\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\t// console.log('current attacker before', currentAttacker);\r\n\t// Apparently it's a toin coss about whether to handle Illidan first or Al'Akir first\r\n\t// Auras are only relevant for Illidan, and already applied there\r\n\tif (Math.random() < 0.5) {\r\n\t\tcurrentAttacker = handlePlayerIllidanHeroPowers(\r\n\t\t\tplayerEntity,\r\n\t\t\tplayerBoard,\r\n\t\t\topponentEntity,\r\n\t\t\topponentBoard,\r\n\t\t\tcurrentAttacker,\r\n\t\t\ttrue,\r\n\t\t\tgameState,\r\n\t\t);\r\n\t\tcurrentAttacker = handlePlayerIllidanHeroPowers(\r\n\t\t\topponentEntity,\r\n\t\t\topponentBoard,\r\n\t\t\tplayerEntity,\r\n\t\t\tplayerBoard,\r\n\t\t\tcurrentAttacker,\r\n\t\t\tfalse,\r\n\t\t\tgameState,\r\n\t\t);\r\n\t} else {\r\n\t\tcurrentAttacker = handlePlayerIllidanHeroPowers(\r\n\t\t\topponentEntity,\r\n\t\t\topponentBoard,\r\n\t\t\tplayerEntity,\r\n\t\t\tplayerBoard,\r\n\t\t\tcurrentAttacker,\r\n\t\t\tfalse,\r\n\t\t\tgameState,\r\n\t\t);\r\n\t\tcurrentAttacker = handlePlayerIllidanHeroPowers(\r\n\t\t\tplayerEntity,\r\n\t\t\tplayerBoard,\r\n\t\t\topponentEntity,\r\n\t\t\topponentBoard,\r\n\t\t\tcurrentAttacker,\r\n\t\t\ttrue,\r\n\t\t\tgameState,\r\n\t\t);\r\n\t}\r\n\tprocessMinionDeath(playerBoard, playerEntity, opponentBoard, opponentEntity, gameState);\r\n\thandleSummonsWhenSpace(playerBoard, playerEntity, opponentBoard, opponentEntity, gameState);\r\n\treturn currentAttacker;\r\n};\r\n\r\nconst handlePlayerIllidanHeroPowers = (\r\n\tplayerEntity: BgsPlayerEntity,\r\n\tplayerBoard: BoardEntity[],\r\n\topponentEntity: BgsPlayerEntity,\r\n\topponentBoard: BoardEntity[],\r\n\tcurrentAttacker: number,\r\n\tfriendly: boolean,\r\n\tgameState: FullGameState,\r\n): number => {\r\n\tif (playerEntity.hpLeft <= 0) {\r\n\t\treturn currentAttacker;\r\n\t}\r\n\tfor (const heroPower of playerEntity.heroPowers) {\r\n\t\tif (heroPower.cardId === CardIds.Wingmen && playerBoard.length > 0) {\r\n\t\t\t// After Illidan triggers, it's always the other opponent's turn\r\n\t\t\t// https://x.com/LoewenMitchell/status/1752714583360639131?s=20\r\n\t\t\thandleIllidanForPlayer(\r\n\t\t\t\tplayerBoard,\r\n\t\t\t\tplayerEntity,\r\n\t\t\t\topponentBoard,\r\n\t\t\t\topponentEntity,\r\n\t\t\t\tgameState,\r\n\t\t\t\tcurrentAttacker,\r\n\t\t\t);\r\n\t\t\t// This is not true anymore: https://replays.firestoneapp.com/?reviewId=7282387d-66cd-458e-8ee1-e04c662e7bad&turn=5&action=1\r\n\t\t\t// currentAttacker = friendly ? 1 : 0;\r\n\t\t\t// In fact there is some adjustment going on: https://replays.firestoneapp.com/?reviewId=929f676f-47f6-494b-9619-df04174a0150&turn=11&action=0\r\n\t\t\t// So trying another logic\r\n\t\t\tcurrentAttacker = (currentAttacker + 1) % 2;\r\n\t\t\t// if (friendly && currentAttacker === 1) {\r\n\t\t\t// \tcurrentAttacker = 0;\r\n\t\t\t// } else if (!friendly && currentAttacker === 0) {\r\n\t\t\t// \tcurrentAttacker = 1;\r\n\t\t\t// }\r\n\t\t\t// friendly = true, currentAttacker = 0 => currentAttacker = 1\r\n\t\t\t// friendly = true, currentAttacker = 1 => currentAttacker = 0\r\n\t\t}\r\n\t}\r\n\treturn currentAttacker;\r\n};\r\n\r\n// TODO: not exactly correct, because of \"attack immediately\", but it's close enough\r\nconst handleIllidanForPlayer = (\r\n\tplayerBoard: BoardEntity[],\r\n\tplayerEntity: BgsPlayerEntity,\r\n\topponentBoard: BoardEntity[],\r\n\topponentEntity: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n\tcurrentAttacker: number,\r\n): void => {\r\n\tif (playerEntity.startOfCombatDone) {\r\n\t\treturn;\r\n\t}\r\n\t// Otherwise, if the first minion dies on the attack, and the board has only 2 minions, we\r\n\t// miss the second one\r\n\tconst minionsAtStart = playerBoard.length;\r\n\tconst firstAttacker = playerBoard[0];\r\n\tconst secondAttacker = minionsAtStart > 1 ? playerBoard[playerBoard.length - 1] : null;\r\n\r\n\t// Stats updates\r\n\tmodifyStats(firstAttacker, 2, 1, playerBoard, playerEntity, gameState);\r\n\tgameState.spectator.registerPowerTarget(firstAttacker, firstAttacker, playerBoard, playerEntity, opponentEntity);\r\n\tif (!!secondAttacker && !secondAttacker.definitelyDead && secondAttacker.health > 0) {\r\n\t\tmodifyStats(secondAttacker, 2, 1, playerBoard, playerEntity, gameState);\r\n\t\tgameState.spectator.registerPowerTarget(\r\n\t\t\tsecondAttacker,\r\n\t\t\tsecondAttacker,\r\n\t\t\tplayerBoard,\r\n\t\t\tplayerEntity,\r\n\t\t\topponentEntity,\r\n\t\t);\r\n\t}\r\n\r\n\t// Attacks\r\n\tfirstAttacker.attackImmediately = true;\r\n\tsimulateAttack(playerBoard, playerEntity, opponentBoard, opponentEntity, gameState);\r\n\t// See http://replays.firestoneapp.com/?reviewId=f16b7a49-c2a2-4ac5-a9eb-a75f83246f70&turn=6&action=8\r\n\tfirstAttacker.hasAttacked = 0;\r\n\tif (!!secondAttacker && !secondAttacker.definitelyDead && secondAttacker.health > 0) {\r\n\t\tsecondAttacker.attackImmediately = true;\r\n\t\tsimulateAttack(playerBoard, playerEntity, opponentBoard, opponentEntity, gameState);\r\n\t\tsecondAttacker.hasAttacked = 0;\r\n\t}\r\n\r\n\t// // See http://replays.firestoneapp.com/?reviewId=7e9ec42c-a8f6-43d2-9f39-cc486dfa2395&turn=6&action=5\r\n\t// if (firstAttacker.definitelyDead || firstAttacker.health <= 0) {\r\n\t// \tcurrentAttacker = (currentAttacker + 1) % 2;\r\n\t// }\r\n\t// return currentAttacker;\r\n};\r\n"]}
1
+ {"version":3,"file":"soc-illidan-hero-power.js","sourceRoot":"","sources":["../../../src/simulation/start-of-combat/soc-illidan-hero-power.ts"],"names":[],"mappings":";;;AAGA,sCAA+D;AAE/D,oCAAuC;AACvC,4DAA8D;AAEvD,MAAM,uBAAuB,GAAG,CACtC,YAA6B,EAC7B,WAA0B,EAC1B,cAA+B,EAC/B,aAA4B,EAC5B,eAAuB,EACvB,SAAwB,EACf,EAAE;IAIX,IAAI,IAAI,CAAC,MAAM,EAAE,GAAG,GAAG,EAAE;QACxB,eAAe,GAAG,6BAA6B,CAC9C,YAAY,EACZ,WAAW,EACX,cAAc,EACd,aAAa,EACb,eAAe,EACf,IAAI,EACJ,SAAS,CACT,CAAC;QACF,eAAe,GAAG,6BAA6B,CAC9C,cAAc,EACd,aAAa,EACb,YAAY,EACZ,WAAW,EACX,eAAe,EACf,KAAK,EACL,SAAS,CACT,CAAC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S,CAAC,CAAC;QACpF,cAAc,CAAC,WAAW,GAAG,CAAC,CAAC;KAC/B;AAOF,CAAC,CAAC","sourcesContent":["import { CardIds } from '@firestone-hs/reference-data';\r\nimport { BgsPlayerEntity } from '../../bgs-player-entity';\r\nimport { BoardEntity } from '../../board-entity';\r\nimport { processMinionDeath, simulateAttack } from '../attack';\r\nimport { FullGameState } from '../internal-game-state';\r\nimport { modifyStats } from '../stats';\r\nimport { handleSummonsWhenSpace } from '../summon-when-space';\r\n\r\nexport const handleIllidanHeroPowers = (\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\t// console.log('current attacker before', currentAttacker);\r\n\t// Apparently it's a toin coss about whether to handle Illidan first or Al'Akir first\r\n\t// Auras are only relevant for Illidan, and already applied there\r\n\tif (Math.random() < 0.5) {\r\n\t\tcurrentAttacker = handlePlayerIllidanHeroPowers(\r\n\t\t\tplayerEntity,\r\n\t\t\tplayerBoard,\r\n\t\t\topponentEntity,\r\n\t\t\topponentBoard,\r\n\t\t\tcurrentAttacker,\r\n\t\t\ttrue,\r\n\t\t\tgameState,\r\n\t\t);\r\n\t\tcurrentAttacker = handlePlayerIllidanHeroPowers(\r\n\t\t\topponentEntity,\r\n\t\t\topponentBoard,\r\n\t\t\tplayerEntity,\r\n\t\t\tplayerBoard,\r\n\t\t\tcurrentAttacker,\r\n\t\t\tfalse,\r\n\t\t\tgameState,\r\n\t\t);\r\n\t} else {\r\n\t\tcurrentAttacker = handlePlayerIllidanHeroPowers(\r\n\t\t\topponentEntity,\r\n\t\t\topponentBoard,\r\n\t\t\tplayerEntity,\r\n\t\t\tplayerBoard,\r\n\t\t\tcurrentAttacker,\r\n\t\t\tfalse,\r\n\t\t\tgameState,\r\n\t\t);\r\n\t\tcurrentAttacker = handlePlayerIllidanHeroPowers(\r\n\t\t\tplayerEntity,\r\n\t\t\tplayerBoard,\r\n\t\t\topponentEntity,\r\n\t\t\topponentBoard,\r\n\t\t\tcurrentAttacker,\r\n\t\t\ttrue,\r\n\t\t\tgameState,\r\n\t\t);\r\n\t}\r\n\tprocessMinionDeath(playerBoard, playerEntity, opponentBoard, opponentEntity, gameState);\r\n\thandleSummonsWhenSpace(playerBoard, playerEntity, opponentBoard, opponentEntity, gameState);\r\n\treturn currentAttacker;\r\n};\r\n\r\nconst handlePlayerIllidanHeroPowers = (\r\n\tplayerEntity: BgsPlayerEntity,\r\n\tplayerBoard: BoardEntity[],\r\n\topponentEntity: BgsPlayerEntity,\r\n\topponentBoard: BoardEntity[],\r\n\tcurrentAttacker: number,\r\n\tfriendly: boolean,\r\n\tgameState: FullGameState,\r\n): number => {\r\n\tif (playerEntity.hpLeft <= 0) {\r\n\t\treturn currentAttacker;\r\n\t}\r\n\tfor (const heroPower of playerEntity.heroPowers) {\r\n\t\tif (heroPower.cardId === CardIds.Wingmen && playerBoard.length > 0) {\r\n\t\t\t// After Illidan triggers, it's always the other opponent's turn\r\n\t\t\t// https://x.com/LoewenMitchell/status/1752714583360639131?s=20\r\n\t\t\thandleIllidanForPlayer(\r\n\t\t\t\tplayerBoard,\r\n\t\t\t\tplayerEntity,\r\n\t\t\t\topponentBoard,\r\n\t\t\t\topponentEntity,\r\n\t\t\t\tgameState,\r\n\t\t\t\tcurrentAttacker,\r\n\t\t\t);\r\n\t\t\t// This is not true anymore: https://replays.firestoneapp.com/?reviewId=7282387d-66cd-458e-8ee1-e04c662e7bad&turn=5&action=1\r\n\t\t\t// currentAttacker = friendly ? 1 : 0;\r\n\t\t\t// In fact there is some adjustment going on: https://replays.firestoneapp.com/?reviewId=929f676f-47f6-494b-9619-df04174a0150&turn=11&action=0\r\n\t\t\t// So trying another logic\r\n\t\t\t// currentAttacker = (currentAttacker + 1) % 2;\r\n\t\t\t// This isn't correct. The following game is a case of:\r\n\t\t\t// The player with the fewer minions is Illidan, so isn't the \"first attacker\"\r\n\t\t\t// Wingmen triggers\r\n\t\t\t// The non-Illidan side then attacks first\r\n\t\t\t// https://replays.firestoneapp.com/?reviewId=45f40e73-4be9-419f-9093-0c2d91a7bac2&turn=5&action=0\r\n\t\t\t// So for now, just randomizing the attacker to try and avoid \"impossible\" scenarios as much as possible\r\n\t\t\tcurrentAttacker = Math.random() < 0.5 ? 0 : 1;\r\n\t\t}\r\n\t}\r\n\treturn currentAttacker;\r\n};\r\n\r\n// TODO: not exactly correct, because of \"attack immediately\", but it's close enough\r\nconst handleIllidanForPlayer = (\r\n\tplayerBoard: BoardEntity[],\r\n\tplayerEntity: BgsPlayerEntity,\r\n\topponentBoard: BoardEntity[],\r\n\topponentEntity: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n\tcurrentAttacker: number,\r\n): void => {\r\n\tif (playerEntity.startOfCombatDone) {\r\n\t\treturn;\r\n\t}\r\n\t// Otherwise, if the first minion dies on the attack, and the board has only 2 minions, we\r\n\t// miss the second one\r\n\tconst minionsAtStart = playerBoard.length;\r\n\tconst firstAttacker = playerBoard[0];\r\n\tconst secondAttacker = minionsAtStart > 1 ? playerBoard[playerBoard.length - 1] : null;\r\n\r\n\t// Stats updates\r\n\tmodifyStats(firstAttacker, 2, 1, playerBoard, playerEntity, gameState);\r\n\tgameState.spectator.registerPowerTarget(firstAttacker, firstAttacker, playerBoard, playerEntity, opponentEntity);\r\n\tif (!!secondAttacker && !secondAttacker.definitelyDead && secondAttacker.health > 0) {\r\n\t\tmodifyStats(secondAttacker, 2, 1, playerBoard, playerEntity, gameState);\r\n\t\tgameState.spectator.registerPowerTarget(\r\n\t\t\tsecondAttacker,\r\n\t\t\tsecondAttacker,\r\n\t\t\tplayerBoard,\r\n\t\t\tplayerEntity,\r\n\t\t\topponentEntity,\r\n\t\t);\r\n\t}\r\n\r\n\t// Attacks\r\n\tfirstAttacker.attackImmediately = true;\r\n\tsimulateAttack(playerBoard, playerEntity, opponentBoard, opponentEntity, gameState);\r\n\t// See http://replays.firestoneapp.com/?reviewId=f16b7a49-c2a2-4ac5-a9eb-a75f83246f70&turn=6&action=8\r\n\tfirstAttacker.hasAttacked = 0;\r\n\tif (!!secondAttacker && !secondAttacker.definitelyDead && secondAttacker.health > 0) {\r\n\t\tsecondAttacker.attackImmediately = true;\r\n\t\tsimulateAttack(playerBoard, playerEntity, opponentBoard, opponentEntity, gameState);\r\n\t\tsecondAttacker.hasAttacked = 0;\r\n\t}\r\n\r\n\t// // See http://replays.firestoneapp.com/?reviewId=7e9ec42c-a8f6-43d2-9f39-cc486dfa2395&turn=6&action=5\r\n\t// if (firstAttacker.definitelyDead || firstAttacker.health <= 0) {\r\n\t// \tcurrentAttacker = (currentAttacker + 1) % 2;\r\n\t// }\r\n\t// return currentAttacker;\r\n};\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"start-of-combat.js","sourceRoot":"","sources":["../../../src/simulation/start-of-combat/start-of-combat.ts"],"names":[],"mappings":";;;AAIA,oCAAiD;AAEjD,mDAA+D;AAC/D,qDAAiE;AACjE,qEAAmE;AACnE,6CAA0D;AAC1D,2EAAwE;AACxE,yDAAqE;AACrE,6CAA0D;AAC1D,+CAA4D;AASrD,MAAM,mBAAmB,GAAG,CAClC,YAA6B,EAC7B,WAA0B,EAC1B,cAA+B,EAC/B,aAA4B,EAC5B,eAAuB,EACvB,SAAwB,EACf,EAAE;IACX,MAAM,8BAA8B,GAAG,IAAI,CAAC;IAC5C,IAAI,8BAA8B,EAAE;QACnC,eAAe;YACd,WAAW,CAAC,MAAM,GAAG,aAAa,CAAC,MAAM;gBACxC,CAAC,CAAC,CAAC;gBACH,CAAC,CAAC,aAAa,CAAC,MAAM,GAAG,WAAW,CAAC,MAAM;oBAC3C,CAAC,CAAC,CAAC;oBACH,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;KAC9B;IAGD,MAAM,MAAM,GAAkC;QAC7C,aAAa;QACb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AK,aAAa;YACjB,OAAO,IAAA,kDAA+B,EACrC,YAAY,EACZ,WAAW,EACX,cAAc,EACd,aAAa,EACb,eAAe,EACf,SAAS,CACT,CAAC;QACH,KAAK,WAAW;YACf,OAAO,IAAA,4CAA4B,EAClC,YAAY,EACZ,WAAW,EACX,cAAc,EACd,aAAa,EACb,eAAe,EACf,SAAS,CACT,CAAC;QACH,KAAK,SAAS;YACb,OAAO,IAAA,yCAA2B,EACjC,YAAY,EACZ,WAAW,EACX,cAAc,EACd,aAAa,EACb,eAAe,EACf,SAAS,CACT,CAAC;QACH,KAAK,oBAAoB;YACxB,OAAO,IAAA,qDAAyB,EAC/B,YAAY,EACZ,WAAW,EACX,cAAc,EACd,aAAa,EACb,eAAe,EACf,SAAS,CACT,CAAC;QACH,KAAK,kBAAkB;YACtB,OAAO,IAAA,gDAAuB,EAC7B,YAAY,EACZ,WAAW,EACX,cAAc,EACd,aAAa,EACb,eAAe,EACf,SAAS,CACT,CAAC;QACH,KAAK,WAAW;YACf,OAAO,IAAA,8CAA6B,EACnC,YAAY,EACZ,WAAW,EACX,cAAc,EACd,aAAa,EACb,eAAe,EACf,SAAS,CACT,CAAC;QACH,KAAK,QAAQ;YACZ,OAAO,IAAA,uCAA0B,EAChC,YAAY,EACZ,WAAW,EACX,cAAc,EACd,aAAa,EACb,eAAe,EACf,SAAS,CACT,CAAC;QACH,KAAK,QAAQ;YACZ,OAAO,IAAA,uCAA0B,EAChC,YAAY,EACZ,WAAW,EACX,cAAc,EACd,aAAa,EACb,eAAe,EACf,iBAAiB,EACjB,mBAAmB,EACnB,SAAS,CACT,CAAC;KACH;AACF,CAAC,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/no-use-before-define */\r\nimport { BgsPlayerEntity } from '../../bgs-player-entity';\r\nimport { BoardEntity } from '../../board-entity';\r\nimport { FullGameState } from '../internal-game-state';\r\nimport { applyAfterStatsUpdate } from '../stats';\r\nimport { StartOfCombatPhase } from './phases';\r\nimport { handleStartOfCombatAnomalies } from './soc-anomalies';\r\nimport { handleStartOfCombatHeroPowers } from './soc-hero-power';\r\nimport { handleIllidanHeroPowers } from './soc-illidan-hero-power';\r\nimport { handleStartOfCombatMinions } from './soc-minion';\r\nimport { handlePreCombatHeroPowers } from './soc-pre-combat-hero-power';\r\nimport { handleStartOfCombatQuestRewards } from './soc-quest-reward';\r\nimport { handleStartOfCombatSecrets } from './soc-secret';\r\nimport { handleStartOfCombatTrinkets } from './soc-trinket';\r\n\r\n// TODO 20/04/2024: I'm not too sure about some ordering. The way I understand it, the Start of Combat has\r\n// multiple phases, and in each phase the player order is random\r\n// However, looking at http://replays.firestoneapp.com/?reviewId=a577602e-06f3-4c4b-928d-36ea98c2e6d5&turn=5&action=0,\r\n// it feels that a \"start of combat\" minion effect could trigger before an opponent's hero power effect\r\n// Or is that limited to Bru'kan?\r\n// I feel that I've asked a lot of questions recently, so I don't want to add that one to the list, as the interaction\r\n// is for now pretty marginal\r\nexport const handleStartOfCombat = (\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\tconst shouldRecomputeCurrentAttacker = true;\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\r\n\t// UPDATE 2024-10-10: changed in 30.6, according to a message from Mitchell on Discord\r\n\tconst phases: readonly StartOfCombatPhase[] = [\r\n\t\t'QuestReward',\r\n\t\t'Anomalies',\r\n\t\t'Trinket',\r\n\t\t// https://twitter.com/DCalkosz/status/1488361384320528388?s=20&t=1ECxRZFdjqwEa2fRsXk32Q\r\n\t\t// There’s a certain order for Start of Combat hero powers, rather than “coin flips” where\r\n\t\t// an unlucky trigger order could mess up some positioning you had planned for your own hero\r\n\t\t// power. “Precombat” (Al’Akir, Y’Shaarj), then Illidan, then others.\r\n\t\t// Update: this seems to have changed: https://x.com/LoewenMitchell/status/1737588920139825335?s=20\r\n\t\t// now you have all hero powers trigger in a first phase, then you have Illidan, and once everything has triggered, you have Tavish\r\n\t\t'PreCombatHeroPower',\r\n\t\t'IllidanHeroPower',\r\n\t\t'HeroPower',\r\n\t\t'Secret',\r\n\t\t'Minion',\r\n\t];\r\n\tlet playerBoardBefore = playerBoard.map((e) => ({ ...e }));\r\n\tlet opponentBoardBefore = opponentBoard.map((e) => ({ ...e }));\r\n\tfor (const phase of phases) {\r\n\t\tcurrentAttacker = handlePhase(\r\n\t\t\tphase,\r\n\t\t\tplayerEntity,\r\n\t\t\tplayerBoard,\r\n\t\t\tplayerBoardBefore,\r\n\t\t\topponentEntity,\r\n\t\t\topponentBoard,\r\n\t\t\topponentBoardBefore,\r\n\t\t\tcurrentAttacker,\r\n\t\t\tgameState,\r\n\t\t);\r\n\t\tif (phase === 'PreCombatHeroPower') {\r\n\t\t\tplayerBoardBefore = playerBoard.map((e) => ({ ...e }));\r\n\t\t\topponentBoardBefore = opponentBoard.map((e) => ({ ...e }));\r\n\t\t}\r\n\t}\r\n\tplayerEntity.startOfCombatDone = true;\r\n\topponentEntity.startOfCombatDone = true;\r\n\tapplyAfterStatsUpdate(gameState);\r\n\treturn currentAttacker;\r\n};\r\n\r\nconst handlePhase = (\r\n\tphase: StartOfCombatPhase,\r\n\tplayerEntity: BgsPlayerEntity,\r\n\tplayerBoard: BoardEntity[],\r\n\tplayerBoardBefore: BoardEntity[],\r\n\topponentEntity: BgsPlayerEntity,\r\n\topponentBoard: BoardEntity[],\r\n\topponentBoardBefore: BoardEntity[],\r\n\tcurrentAttacker: number,\r\n\tgameState: FullGameState,\r\n): number => {\r\n\tswitch (phase) {\r\n\t\tcase 'QuestReward':\r\n\t\t\treturn handleStartOfCombatQuestRewards(\r\n\t\t\t\tplayerEntity,\r\n\t\t\t\tplayerBoard,\r\n\t\t\t\topponentEntity,\r\n\t\t\t\topponentBoard,\r\n\t\t\t\tcurrentAttacker,\r\n\t\t\t\tgameState,\r\n\t\t\t);\r\n\t\tcase 'Anomalies':\r\n\t\t\treturn handleStartOfCombatAnomalies(\r\n\t\t\t\tplayerEntity,\r\n\t\t\t\tplayerBoard,\r\n\t\t\t\topponentEntity,\r\n\t\t\t\topponentBoard,\r\n\t\t\t\tcurrentAttacker,\r\n\t\t\t\tgameState,\r\n\t\t\t);\r\n\t\tcase 'Trinket':\r\n\t\t\treturn handleStartOfCombatTrinkets(\r\n\t\t\t\tplayerEntity,\r\n\t\t\t\tplayerBoard,\r\n\t\t\t\topponentEntity,\r\n\t\t\t\topponentBoard,\r\n\t\t\t\tcurrentAttacker,\r\n\t\t\t\tgameState,\r\n\t\t\t);\r\n\t\tcase 'PreCombatHeroPower':\r\n\t\t\treturn handlePreCombatHeroPowers(\r\n\t\t\t\tplayerEntity,\r\n\t\t\t\tplayerBoard,\r\n\t\t\t\topponentEntity,\r\n\t\t\t\topponentBoard,\r\n\t\t\t\tcurrentAttacker,\r\n\t\t\t\tgameState,\r\n\t\t\t);\r\n\t\tcase 'IllidanHeroPower':\r\n\t\t\treturn handleIllidanHeroPowers(\r\n\t\t\t\tplayerEntity,\r\n\t\t\t\tplayerBoard,\r\n\t\t\t\topponentEntity,\r\n\t\t\t\topponentBoard,\r\n\t\t\t\tcurrentAttacker,\r\n\t\t\t\tgameState,\r\n\t\t\t);\r\n\t\tcase 'HeroPower':\r\n\t\t\treturn handleStartOfCombatHeroPowers(\r\n\t\t\t\tplayerEntity,\r\n\t\t\t\tplayerBoard,\r\n\t\t\t\topponentEntity,\r\n\t\t\t\topponentBoard,\r\n\t\t\t\tcurrentAttacker,\r\n\t\t\t\tgameState,\r\n\t\t\t);\r\n\t\tcase 'Secret':\r\n\t\t\treturn handleStartOfCombatSecrets(\r\n\t\t\t\tplayerEntity,\r\n\t\t\t\tplayerBoard,\r\n\t\t\t\topponentEntity,\r\n\t\t\t\topponentBoard,\r\n\t\t\t\tcurrentAttacker,\r\n\t\t\t\tgameState,\r\n\t\t\t);\r\n\t\tcase 'Minion':\r\n\t\t\treturn handleStartOfCombatMinions(\r\n\t\t\t\tplayerEntity,\r\n\t\t\t\tplayerBoard,\r\n\t\t\t\topponentEntity,\r\n\t\t\t\topponentBoard,\r\n\t\t\t\tcurrentAttacker,\r\n\t\t\t\tplayerBoardBefore,\r\n\t\t\t\topponentBoardBefore,\r\n\t\t\t\tgameState,\r\n\t\t\t);\r\n\t}\r\n};\r\n"]}
1
+ {"version":3,"file":"start-of-combat.js","sourceRoot":"","sources":["../../../src/simulation/start-of-combat/start-of-combat.ts"],"names":[],"mappings":";;;AAIA,oCAAiD;AAEjD,mDAA+D;AAC/D,qDAAiE;AACjE,qEAAmE;AACnE,6CAA0D;AAC1D,2EAAwE;AACxE,yDAAqE;AACrE,6CAA0D;AAC1D,+CAA4D;AASrD,MAAM,mBAAmB,GAAG,CAClC,YAA6B,EAC7B,WAA0B,EAC1B,cAA+B,EAC/B,aAA4B,EAC5B,eAAuB,EACvB,SAAwB,EACf,EAAE;IACX,MAAM,8BAA8B,GAAG,IAAI,CAAC;IAC5C,IAAI,8BAA8B,EAAE;QACnC,eAAe;YACd,WAAW,CAAC,MAAM,GAAG,aAAa,CAAC,MAAM;gBACxC,CAAC,CAAC,CAAC;gBACH,CAAC,CAAC,aAAa,CAAC,MAAM,GAAG,WAAW,CAAC,MAAM;oBAC3C,CAAC,CAAC,CAAC;oBACH,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;KAC9B;IAGD,MAAM,MAAM,GAAkC;QAC7C,aAAa;QACb,WAAW;QACX,SAAS;QAWT,oBAAoB;QACpB,kBAAkB;QAClB,WAAW;QACX,QAAQ;QACR,QAAQ;KACR,CAAC;IACF,IAAI,iBAAi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AC;QACH,KAAK,WAAW;YACf,OAAO,IAAA,4CAA4B,EAClC,YAAY,EACZ,WAAW,EACX,cAAc,EACd,aAAa,EACb,eAAe,EACf,SAAS,CACT,CAAC;QACH,KAAK,SAAS;YACb,OAAO,IAAA,yCAA2B,EACjC,YAAY,EACZ,WAAW,EACX,cAAc,EACd,aAAa,EACb,eAAe,EACf,SAAS,CACT,CAAC;QACH,KAAK,oBAAoB;YACxB,OAAO,IAAA,qDAAyB,EAC/B,YAAY,EACZ,WAAW,EACX,cAAc,EACd,aAAa,EACb,eAAe,EACf,SAAS,CACT,CAAC;QACH,KAAK,kBAAkB;YACtB,OAAO,IAAA,gDAAuB,EAC7B,YAAY,EACZ,WAAW,EACX,cAAc,EACd,aAAa,EACb,eAAe,EACf,SAAS,CACT,CAAC;QACH,KAAK,WAAW;YACf,OAAO,IAAA,8CAA6B,EACnC,YAAY,EACZ,WAAW,EACX,cAAc,EACd,aAAa,EACb,eAAe,EACf,SAAS,CACT,CAAC;QACH,KAAK,QAAQ;YACZ,OAAO,IAAA,uCAA0B,EAChC,YAAY,EACZ,WAAW,EACX,cAAc,EACd,aAAa,EACb,eAAe,EACf,SAAS,CACT,CAAC;QACH,KAAK,QAAQ;YACZ,OAAO,IAAA,uCAA0B,EAChC,YAAY,EACZ,WAAW,EACX,cAAc,EACd,aAAa,EACb,eAAe,EACf,iBAAiB,EACjB,mBAAmB,EACnB,SAAS,CACT,CAAC;KACH;AACF,CAAC,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/no-use-before-define */\r\nimport { BgsPlayerEntity } from '../../bgs-player-entity';\r\nimport { BoardEntity } from '../../board-entity';\r\nimport { FullGameState } from '../internal-game-state';\r\nimport { applyAfterStatsUpdate } from '../stats';\r\nimport { StartOfCombatPhase } from './phases';\r\nimport { handleStartOfCombatAnomalies } from './soc-anomalies';\r\nimport { handleStartOfCombatHeroPowers } from './soc-hero-power';\r\nimport { handleIllidanHeroPowers } from './soc-illidan-hero-power';\r\nimport { handleStartOfCombatMinions } from './soc-minion';\r\nimport { handlePreCombatHeroPowers } from './soc-pre-combat-hero-power';\r\nimport { handleStartOfCombatQuestRewards } from './soc-quest-reward';\r\nimport { handleStartOfCombatSecrets } from './soc-secret';\r\nimport { handleStartOfCombatTrinkets } from './soc-trinket';\r\n\r\n// TODO 20/04/2024: I'm not too sure about some ordering. The way I understand it, the Start of Combat has\r\n// multiple phases, and in each phase the player order is random\r\n// However, looking at http://replays.firestoneapp.com/?reviewId=a577602e-06f3-4c4b-928d-36ea98c2e6d5&turn=5&action=0,\r\n// it feels that a \"start of combat\" minion effect could trigger before an opponent's hero power effect\r\n// Or is that limited to Bru'kan?\r\n// I feel that I've asked a lot of questions recently, so I don't want to add that one to the list, as the interaction\r\n// is for now pretty marginal\r\nexport const handleStartOfCombat = (\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\tconst shouldRecomputeCurrentAttacker = true;\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\r\n\t// UPDATE 2024-10-10: changed in 30.6, according to a message from Mitchell on Discord\r\n\tconst phases: readonly StartOfCombatPhase[] = [\r\n\t\t'QuestReward',\r\n\t\t'Anomalies',\r\n\t\t'Trinket',\r\n\t\t// https://twitter.com/DCalkosz/status/1488361384320528388?s=20&t=1ECxRZFdjqwEa2fRsXk32Q\r\n\t\t// There’s a certain order for Start of Combat hero powers, rather than “coin flips” where\r\n\t\t// an unlucky trigger order could mess up some positioning you had planned for your own hero\r\n\t\t// power. “Precombat” (Al’Akir, Y’Shaarj), then Illidan, then others.\r\n\t\t// Update: this seems to have changed: https://x.com/LoewenMitchell/status/1737588920139825335?s=20\r\n\t\t// now you have all hero powers trigger in a first phase, then you have Illidan, and once everything has triggered, you have Tavish\r\n\t\t// All Hero powers are split up in to 3 categories:\r\n\t\t// 1st - Precombat Hero Power Triggers (things we want to go before Illidan e.g. Lich King)\r\n\t\t// 2nd - Hero Power Triggers First In Combat (Illidan)\r\n\t\t// 3rd - All other Start of Combat Hero Powers\r\n\t\t'PreCombatHeroPower',\r\n\t\t'IllidanHeroPower',\r\n\t\t'HeroPower',\r\n\t\t'Secret',\r\n\t\t'Minion',\r\n\t];\r\n\tlet playerBoardBefore = playerBoard.map((e) => ({ ...e }));\r\n\tlet opponentBoardBefore = opponentBoard.map((e) => ({ ...e }));\r\n\tfor (const phase of phases) {\r\n\t\tcurrentAttacker = handlePhase(\r\n\t\t\tphase,\r\n\t\t\tplayerEntity,\r\n\t\t\tplayerBoard,\r\n\t\t\tplayerBoardBefore,\r\n\t\t\topponentEntity,\r\n\t\t\topponentBoard,\r\n\t\t\topponentBoardBefore,\r\n\t\t\tcurrentAttacker,\r\n\t\t\tgameState,\r\n\t\t);\r\n\t\tif (phase === 'PreCombatHeroPower') {\r\n\t\t\tplayerBoardBefore = playerBoard.map((e) => ({ ...e }));\r\n\t\t\topponentBoardBefore = opponentBoard.map((e) => ({ ...e }));\r\n\t\t}\r\n\t}\r\n\tplayerEntity.startOfCombatDone = true;\r\n\topponentEntity.startOfCombatDone = true;\r\n\tapplyAfterStatsUpdate(gameState);\r\n\treturn currentAttacker;\r\n};\r\n\r\nconst handlePhase = (\r\n\tphase: StartOfCombatPhase,\r\n\tplayerEntity: BgsPlayerEntity,\r\n\tplayerBoard: BoardEntity[],\r\n\tplayerBoardBefore: BoardEntity[],\r\n\topponentEntity: BgsPlayerEntity,\r\n\topponentBoard: BoardEntity[],\r\n\topponentBoardBefore: BoardEntity[],\r\n\tcurrentAttacker: number,\r\n\tgameState: FullGameState,\r\n): number => {\r\n\tswitch (phase) {\r\n\t\tcase 'QuestReward':\r\n\t\t\treturn handleStartOfCombatQuestRewards(\r\n\t\t\t\tplayerEntity,\r\n\t\t\t\tplayerBoard,\r\n\t\t\t\topponentEntity,\r\n\t\t\t\topponentBoard,\r\n\t\t\t\tcurrentAttacker,\r\n\t\t\t\tgameState,\r\n\t\t\t);\r\n\t\tcase 'Anomalies':\r\n\t\t\treturn handleStartOfCombatAnomalies(\r\n\t\t\t\tplayerEntity,\r\n\t\t\t\tplayerBoard,\r\n\t\t\t\topponentEntity,\r\n\t\t\t\topponentBoard,\r\n\t\t\t\tcurrentAttacker,\r\n\t\t\t\tgameState,\r\n\t\t\t);\r\n\t\tcase 'Trinket':\r\n\t\t\treturn handleStartOfCombatTrinkets(\r\n\t\t\t\tplayerEntity,\r\n\t\t\t\tplayerBoard,\r\n\t\t\t\topponentEntity,\r\n\t\t\t\topponentBoard,\r\n\t\t\t\tcurrentAttacker,\r\n\t\t\t\tgameState,\r\n\t\t\t);\r\n\t\tcase 'PreCombatHeroPower':\r\n\t\t\treturn handlePreCombatHeroPowers(\r\n\t\t\t\tplayerEntity,\r\n\t\t\t\tplayerBoard,\r\n\t\t\t\topponentEntity,\r\n\t\t\t\topponentBoard,\r\n\t\t\t\tcurrentAttacker,\r\n\t\t\t\tgameState,\r\n\t\t\t);\r\n\t\tcase 'IllidanHeroPower':\r\n\t\t\treturn handleIllidanHeroPowers(\r\n\t\t\t\tplayerEntity,\r\n\t\t\t\tplayerBoard,\r\n\t\t\t\topponentEntity,\r\n\t\t\t\topponentBoard,\r\n\t\t\t\tcurrentAttacker,\r\n\t\t\t\tgameState,\r\n\t\t\t);\r\n\t\tcase 'HeroPower':\r\n\t\t\treturn handleStartOfCombatHeroPowers(\r\n\t\t\t\tplayerEntity,\r\n\t\t\t\tplayerBoard,\r\n\t\t\t\topponentEntity,\r\n\t\t\t\topponentBoard,\r\n\t\t\t\tcurrentAttacker,\r\n\t\t\t\tgameState,\r\n\t\t\t);\r\n\t\tcase 'Secret':\r\n\t\t\treturn handleStartOfCombatSecrets(\r\n\t\t\t\tplayerEntity,\r\n\t\t\t\tplayerBoard,\r\n\t\t\t\topponentEntity,\r\n\t\t\t\topponentBoard,\r\n\t\t\t\tcurrentAttacker,\r\n\t\t\t\tgameState,\r\n\t\t\t);\r\n\t\tcase 'Minion':\r\n\t\t\treturn handleStartOfCombatMinions(\r\n\t\t\t\tplayerEntity,\r\n\t\t\t\tplayerBoard,\r\n\t\t\t\topponentEntity,\r\n\t\t\t\topponentBoard,\r\n\t\t\t\tcurrentAttacker,\r\n\t\t\t\tplayerBoardBefore,\r\n\t\t\t\topponentBoardBefore,\r\n\t\t\t\tgameState,\r\n\t\t\t);\r\n\t}\r\n};\r\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@firestone-hs/simulate-bgs-battle",
3
- "version": "1.1.557",
3
+ "version": "1.1.559",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "lint": "eslint --color --fix --ext .ts .",