@firestone-hs/simulate-bgs-battle 1.1.491 → 1.1.493
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cards/card.interface.d.ts +2 -1
- package/dist/cards/card.interface.js.map +1 -1
- package/dist/cards/impl/bg-spell/boon-of-beetles.d.ts +5 -0
- package/dist/cards/impl/bg-spell/boon-of-beetles.js +10 -0
- package/dist/cards/impl/bg-spell/boon-of-beetles.js.map +1 -0
- package/dist/cards/impl/bg-spell/toxic-tumbleweed.d.ts +8 -0
- package/dist/cards/impl/bg-spell/toxic-tumbleweed.js +16 -0
- package/dist/cards/impl/bg-spell/toxic-tumbleweed.js.map +1 -0
- package/dist/cards/impl/bg-spell/upper-hand.d.ts +5 -0
- package/dist/cards/impl/bg-spell/upper-hand.js +16 -0
- package/dist/cards/impl/bg-spell/upper-hand.js.map +1 -0
- package/dist/cards/impl/hero-power/wax-warband.js +8 -2
- package/dist/cards/impl/hero-power/wax-warband.js.map +1 -1
- package/dist/cards/impl/minion/carbonic-copy.js +3 -1
- package/dist/cards/impl/minion/carbonic-copy.js.map +1 -1
- package/dist/cards/impl/quest-reward/evil-twin.d.ts +4 -1
- package/dist/cards/impl/quest-reward/evil-twin.js +2 -2
- package/dist/cards/impl/quest-reward/evil-twin.js.map +1 -1
- package/dist/cards/impl/spell/fleeting-vigor.d.ts +5 -0
- package/dist/cards/impl/spell/fleeting-vigor.js +11 -0
- package/dist/cards/impl/spell/fleeting-vigor.js.map +1 -0
- package/dist/cards/impl/trinket/automaton-portrait.d.ts +2 -5
- package/dist/cards/impl/trinket/automaton-portrait.js +1 -1
- package/dist/cards/impl/trinket/automaton-portrait.js.map +1 -1
- package/dist/cards/impl/trinket/fishy-sticker.d.ts +4 -1
- package/dist/cards/impl/trinket/fishy-sticker.js +1 -11
- package/dist/cards/impl/trinket/fishy-sticker.js.map +1 -1
- package/dist/cards/impl/trinket/karazhan-chess-set.d.ts +2 -5
- package/dist/cards/impl/trinket/karazhan-chess-set.js +1 -11
- package/dist/cards/impl/trinket/karazhan-chess-set.js.map +1 -1
- package/dist/cards/impl/trinket/summoning-sphere.d.ts +4 -1
- package/dist/cards/impl/trinket/summoning-sphere.js +1 -1
- package/dist/cards/impl/trinket/summoning-sphere.js.map +1 -1
- package/dist/simulation/add-minion-to-board.js +1 -1
- package/dist/simulation/add-minion-to-board.js.map +1 -1
- package/dist/simulation/auras.d.ts +1 -0
- package/dist/simulation/auras.js +26 -1
- package/dist/simulation/auras.js.map +1 -1
- package/dist/simulation/spawn-fail.js +1 -1
- package/dist/simulation/spawn-fail.js.map +1 -1
- package/dist/simulation/spectator/spectator.js +2 -1
- package/dist/simulation/spectator/spectator.js.map +1 -1
- package/dist/simulation/start-of-combat/soc-action-processor.d.ts +2 -1
- package/dist/simulation/start-of-combat/soc-action-processor.js +20 -3
- package/dist/simulation/start-of-combat/soc-action-processor.js.map +1 -1
- package/dist/simulation/start-of-combat/soc-anomalies.js +1 -1
- package/dist/simulation/start-of-combat/soc-anomalies.js.map +1 -1
- package/dist/simulation/start-of-combat/soc-hero-power.js +1 -3
- package/dist/simulation/start-of-combat/soc-hero-power.js.map +1 -1
- package/dist/simulation/start-of-combat/soc-minion.js +1 -3
- package/dist/simulation/start-of-combat/soc-minion.js.map +1 -1
- package/dist/simulation/start-of-combat/soc-pre-combat-hero-power.js +1 -3
- package/dist/simulation/start-of-combat/soc-pre-combat-hero-power.js.map +1 -1
- package/dist/simulation/start-of-combat/soc-quest-reward.js +1 -1
- package/dist/simulation/start-of-combat/soc-quest-reward.js.map +1 -1
- package/dist/simulation/start-of-combat/soc-secret.js +43 -36
- package/dist/simulation/start-of-combat/soc-secret.js.map +1 -1
- package/dist/simulation/start-of-combat/soc-trinket.js +1 -1
- package/dist/simulation/start-of-combat/soc-trinket.js.map +1 -1
- package/dist/utils.js +1 -1
- package/dist/utils.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version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AE,CAAC,CAAC,MAAM;YAChB,QAAQ,EAAE,CAAC,CAAC,QAAQ;YACpB,cAAc,EAAE,CAAC,CAAC,cAAc;YAChC,cAAc,EAAE,CAAC,CAAC,cAAc;SACf,CAAA,CACnB,CAAC;IACH,CAAC;CACD;AAnaD,8BAmaC","sourcesContent":["import { BgsPlayerEntity, BoardTrinket } from '../../bgs-player-entity';\r\nimport { BoardEntity } from '../../board-entity';\r\nimport { BoardSecret } from '../../board-secret';\r\nimport { GameAction, buildGameAction } from './game-action';\r\nimport { GameSample } from './game-sample';\r\n\r\nconst MAX_SAMPLES = 1;\r\n\r\nexport class Spectator {\r\n\tprivate actionsForCurrentBattle: GameAction[];\r\n\tprivate wonBattles: GameSample[];\r\n\tprivate tiedBattles: GameSample[];\r\n\tprivate lostBattles: GameSample[];\r\n\r\n\tconstructor() {\r\n\t\tthis.actionsForCurrentBattle = [];\r\n\t\tthis.wonBattles = [];\r\n\t\tthis.tiedBattles = [];\r\n\t\tthis.lostBattles = [];\r\n\t}\r\n\r\n\tpublic prune(): void {\r\n\t\tthis.wonBattles = this.wonBattles.slice(0, MAX_SAMPLES);\r\n\t\tthis.lostBattles = this.lostBattles.slice(0, MAX_SAMPLES);\r\n\t\tthis.tiedBattles = this.tiedBattles.slice(0, MAX_SAMPLES);\r\n\t}\r\n\r\n\tpublic buildOutcomeSamples(): {\r\n\t\twon: readonly GameSample[];\r\n\t\tlost: readonly GameSample[];\r\n\t\ttied: readonly GameSample[];\r\n\t} {\r\n\t\treturn {\r\n\t\t\twon: this.wonBattles?.map((battle) => this.cleanUpActions(battle)),\r\n\t\t\tlost: this.lostBattles?.map((battle) => this.cleanUpActions(battle)),\r\n\t\t\ttied: this.tiedBattles?.map((battle) => this.cleanUpActions(battle)),\r\n\t\t};\r\n\t}\r\n\r\n\tprivate cleanUpActions(battle: GameSample): GameSample {\r\n\t\tconst collapsed = this.collapseActions(battle.actions);\r\n\t\tconst result: GameSample = {\r\n\t\t\t...battle,\r\n\t\t\tactions: collapsed,\r\n\t\t};\r\n\t\treturn result;\r\n\t}\r\n\r\n\tpublic commitBattleResult(result: 'won' | 'lost' | 'tied'): void {\r\n\t\tif (\r\n\t\t\tthis.wonBattles.length >= MAX_SAMPLES &&\r\n\t\t\tthis.lostBattles.length >= MAX_SAMPLES &&\r\n\t\t\tthis.tiedBattles.length >= MAX_SAMPLES\r\n\t\t) {\r\n\t\t\tthis.actionsForCurrentBattle = [];\r\n\t\t\treturn;\r\n\t\t}\r\n\t\t// const actionsForBattle = this.collapseActions(this.actionsForCurrentBattle);\r\n\t\tconst actionsForBattle = this.actionsForCurrentBattle;\r\n\t\tthis.actionsForCurrentBattle = [];\r\n\r\n\t\tconst battle: GameSample = {\r\n\t\t\tactions: actionsForBattle,\r\n\t\t};\r\n\t\tswitch (result) {\r\n\t\t\tcase 'won':\r\n\t\t\t\tthis.wonBattles.push(battle);\r\n\t\t\t\tbreak;\r\n\t\t\tcase 'lost':\r\n\t\t\t\tthis.lostBattles.push(battle);\r\n\t\t\t\tbreak;\r\n\t\t\tcase 'tied':\r\n\t\t\t\tthis.tiedBattles.push(battle);\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n\r\n\tpublic registerAttack(\r\n\t\tattackingEntity: BoardEntity,\r\n\t\tdefendingEntity: BoardEntity,\r\n\t\tattackingBoard: readonly BoardEntity[],\r\n\t\tdefendingBoard: readonly BoardEntity[],\r\n\t\tattackingBoardHero: BgsPlayerEntity,\r\n\t\tdefendingBoardHero: BgsPlayerEntity,\r\n\t): void {\r\n\t\t// console.debug(\r\n\t\t// \t'\\n register attack',\r\n\t\t// \tstringifySimple(attackingBoard),\r\n\t\t// \t'\\n',\r\n\t\t// \tstringifySimple(defendingBoard),\r\n\t\t// \t'\\n',\r\n\t\t// \tattackingBoard.find((e) => e.entityId === 2441),\r\n\t\t// \t'\\n',\r\n\t\t// \tattackingBoard.find((e) => e.entityId === 2442),\r\n\t\t// );\r\n\t\tconst isAttackerFriendly = attackingBoard.every((entity) => entity.friendly);\r\n\t\tconst playerHero = isAttackerFriendly ? attackingBoardHero : defendingBoardHero;\r\n\t\tconst opponentHero = isAttackerFriendly ? defendingBoardHero : attackingBoardHero;\r\n\t\tconst friendlyBoard = isAttackerFriendly ? attackingBoard : defendingBoard;\r\n\t\tconst opponentBoard = isAttackerFriendly ? defendingBoard : attackingBoard;\r\n\t\tconst action: GameAction = buildGameAction(playerHero, opponentHero, {\r\n\t\t\ttype: 'attack',\r\n\t\t\tsourceEntityId: attackingEntity.entityId,\r\n\t\t\ttargetEntityId: defendingEntity.entityId,\r\n\t\t\tplayerBoard: this.sanitize(friendlyBoard),\r\n\t\t\tplayerHand: this.sanitize(playerHero.hand),\r\n\t\t\topponentBoard: this.sanitize(opponentBoard),\r\n\t\t\topponentHand: this.sanitize(opponentHero.hand),\r\n\t\t});\r\n\t\tthis.addAction(action);\r\n\t}\r\n\r\n\tpublic registerStartOfCombat(\r\n\t\tfriendlyBoard: readonly BoardEntity[],\r\n\t\topponentBoard: readonly BoardEntity[],\r\n\t\tfriendlyHero: BgsPlayerEntity,\r\n\t\topponentHero: BgsPlayerEntity,\r\n\t): void {\r\n\t\tconst action: GameAction = buildGameAction(friendlyHero, opponentHero, {\r\n\t\t\ttype: 'start-of-combat',\r\n\t\t\tplayerBoard: this.sanitize(friendlyBoard),\r\n\t\t\topponentBoard: this.sanitize(opponentBoard),\r\n\t\t\tplayerHand: this.sanitize(friendlyHero.hand),\r\n\t\t\topponentHand: this.sanitize(opponentHero.hand),\r\n\t\t});\r\n\t\tthis.addAction(action);\r\n\t}\r\n\r\n\tpublic registerPlayerAttack(\r\n\t\tfriendlyBoard: readonly BoardEntity[],\r\n\t\topponentBoard: readonly BoardEntity[],\r\n\t\tdamage: number,\r\n\t): void {\r\n\t\tconst action: GameAction = buildGameAction(null, null, {\r\n\t\t\ttype: 'player-attack',\r\n\t\t\tplayerBoard: this.sanitize(friendlyBoard),\r\n\t\t\topponentBoard: this.sanitize(opponentBoard),\r\n\t\t\tplayerHand: null,\r\n\t\t\topponentHand: null,\r\n\t\t\tdamages: [\r\n\t\t\t\t{\r\n\t\t\t\t\tdamage: damage,\r\n\t\t\t\t},\r\n\t\t\t],\r\n\t\t});\r\n\t\tthis.addAction(action);\r\n\t}\r\n\r\n\tpublic registerOpponentAttack(\r\n\t\tfriendlyBoard: readonly BoardEntity[],\r\n\t\topponentBoard: readonly BoardEntity[],\r\n\t\tdamage: number,\r\n\t): void {\r\n\t\tconst action: GameAction = buildGameAction(null, null, {\r\n\t\t\ttype: 'opponent-attack',\r\n\t\t\tplayerBoard: this.sanitize(friendlyBoard),\r\n\t\t\topponentBoard: this.sanitize(opponentBoard),\r\n\t\t\tplayerHand: null,\r\n\t\t\topponentHand: null,\r\n\t\t\tdamages: [\r\n\t\t\t\t{\r\n\t\t\t\t\tdamage: damage,\r\n\t\t\t\t},\r\n\t\t\t],\r\n\t\t});\r\n\t\tthis.addAction(action);\r\n\t}\r\n\r\n\tpublic registerDamageDealt(\r\n\t\tdamagingEntity: BoardEntity,\r\n\t\tdamagedEntity: BoardEntity,\r\n\t\tdamageTaken: number,\r\n\t\tdamagedEntityBoard: BoardEntity[],\r\n\t): void {\r\n\t\tif (!damagingEntity.entityId) {\r\n\t\t\t// console.error('missing damaging entity id', damagingEntity.cardId);\r\n\t\t}\r\n\t\tconst friendlyBoard = damagedEntityBoard.every((entity) => entity.friendly) ? damagedEntityBoard : null;\r\n\t\tconst opponentBoard = damagedEntityBoard.every((entity) => !entity.friendly) ? damagedEntityBoard : null;\r\n\t\tconst action: GameAction = buildGameAction(null, null, {\r\n\t\t\ttype: 'damage',\r\n\t\t\tdamages: [\r\n\t\t\t\t{\r\n\t\t\t\t\tsourceEntityId: damagingEntity.entityId,\r\n\t\t\t\t\ttargetEntityId: damagedEntity.entityId,\r\n\t\t\t\t\tdamage: damageTaken,\r\n\t\t\t\t},\r\n\t\t\t],\r\n\t\t\tplayerBoard: this.sanitize(friendlyBoard),\r\n\t\t\topponentBoard: this.sanitize(opponentBoard),\r\n\t\t\tplayerHand: null,\r\n\t\t\topponentHand: null,\r\n\t\t});\r\n\t\tthis.addAction(action);\r\n\t}\r\n\r\n\tpublic registerPowerTarget(\r\n\t\tsourceEntity: BoardEntity | BgsPlayerEntity | BoardSecret | BoardTrinket,\r\n\t\ttargetEntity: BoardEntity | BgsPlayerEntity,\r\n\t\ttargetBoard: BoardEntity[],\r\n\t\thero1: BgsPlayerEntity,\r\n\t\thero2: BgsPlayerEntity,\r\n\t): void {\r\n\t\tif (!targetEntity) {\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tif (!sourceEntity.entityId && !(sourceEntity as BgsPlayerEntity).heroPowerId) {\r\n\t\t\t// console.error('missing damaging entity id', sourceEntity.cardId);\r\n\t\t}\r\n\t\t// console.log('registerPowerTarget', stringifySimpleCard(sourceEntity), stringifySimpleCard(targetEntity), new Error().stack);\r\n\t\tconst friendlyBoard = targetBoard?.every((entity) => entity.friendly) ? targetBoard : null;\r\n\t\tconst opponentBoard = targetBoard?.every((entity) => !entity.friendly) ? targetBoard : null;\r\n\t\tconst friendlyHero = hero1?.friendly ? hero1 : hero2?.friendly ? hero2 : null;\r\n\t\tconst opponentHero = hero1?.friendly ? hero2 : hero2?.friendly ? hero1 : null;\r\n\t\tconst action: GameAction = buildGameAction(friendlyHero, opponentHero, {\r\n\t\t\ttype: 'power-target',\r\n\t\t\tsourceEntityId: sourceEntity.entityId,\r\n\t\t\ttargetEntityId: targetEntity.entityId,\r\n\t\t\tplayerBoard: this.sanitize(friendlyBoard),\r\n\t\t\topponentBoard: this.sanitize(opponentBoard),\r\n\t\t\tplayerHand: this.sanitize(friendlyHero?.hand),\r\n\t\t\topponentHand: this.sanitize(opponentHero?.hand),\r\n\t\t});\r\n\t\tthis.addAction(action);\r\n\t}\r\n\r\n\tpublic registerMinionsSpawn(\r\n\t\tsourceEntity: BoardEntity | BgsPlayerEntity,\r\n\t\tboardOnWhichToSpawn: BoardEntity[],\r\n\t\tspawnedEntities: readonly BoardEntity[],\r\n\t): void {\r\n\t\tif (!spawnedEntities || spawnedEntities.length === 0) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tif (!sourceEntity?.entityId) {\r\n\t\t\t// console.error('missing spawn source entity id', sourceEntity);\r\n\t\t}\r\n\t\tconst friendlyBoard = boardOnWhichToSpawn.every((entity) => entity.friendly) ? boardOnWhichToSpawn : null;\r\n\t\tconst opponentBoard = boardOnWhichToSpawn.every((entity) => !entity.friendly) ? boardOnWhichToSpawn : null;\r\n\t\tconst action: GameAction = buildGameAction(null, null, {\r\n\t\t\ttype: 'spawn',\r\n\t\t\tspawns: this.sanitize(spawnedEntities),\r\n\t\t\tsourceEntityId: sourceEntity?.entityId,\r\n\t\t\tplayerBoard: this.sanitize(friendlyBoard),\r\n\t\t\topponentBoard: this.sanitize(opponentBoard),\r\n\t\t\tplayerHand: null,\r\n\t\t\topponentHand: null,\r\n\t\t});\r\n\t\tthis.addAction(action);\r\n\t}\r\n\r\n\tpublic registerDeadEntities(\r\n\t\tdeadMinionIndexes1: number[],\r\n\t\tdeadEntities1: BoardEntity[],\r\n\t\tboard1: BoardEntity[],\r\n\t\tdeadMinionIndexes2: number[],\r\n\t\tdeadEntities2: BoardEntity[],\r\n\t\tboard2: BoardEntity[],\r\n\t): void {\r\n\t\tconst deaths = [...(deadEntities1 || []), ...(deadEntities2 || [])];\r\n\t\tif (!deaths || deaths.length === 0) {\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tconst action: GameAction = buildGameAction(null, null, {\r\n\t\t\ttype: 'minion-death',\r\n\t\t\tdeaths: this.sanitize(deaths),\r\n\t\t\tdeadMinionsPositionsOnBoard: [\r\n\t\t\t\t...(deadMinionIndexes1 || []).map((i) => board1.length - i),\r\n\t\t\t\t...(deadMinionIndexes2 || []).map((i) => board2.length - i),\r\n\t\t\t],\r\n\t\t});\r\n\t\tthis.addAction(action);\r\n\t}\r\n\r\n\tprivate addAction(action: GameAction) {\r\n\t\tthis.actionsForCurrentBattle.push(action);\r\n\t}\r\n\r\n\tprivate collapseActions(actions: readonly GameAction[]): readonly GameAction[] {\r\n\t\tif (!actions || actions.length === 0) {\r\n\t\t\treturn [];\r\n\t\t}\r\n\t\tconst result: GameAction[] = [];\r\n\t\tfor (let i = 0; i < actions.length; i++) {\r\n\t\t\tconst action: GameAction = {\r\n\t\t\t\t...actions[i],\r\n\t\t\t\tplayerBoard: this.sanitize(actions[i].playerBoard),\r\n\t\t\t\topponentBoard: this.sanitize(actions[i].opponentBoard),\r\n\t\t\t\tplayerHand: this.sanitize(actions[i].playerHand),\r\n\t\t\t\topponentHand: this.sanitize(actions[i].opponentHand),\r\n\t\t\t\t// spawns: this.sanitize(actions[i].spawns),\r\n\t\t\t\tdeaths: this.sanitize(actions[i].deaths),\r\n\t\t\t\tplayerTrinkets: this.sanitizeTrinkets(actions[i].playerTrinkets),\r\n\t\t\t\topponentTrinkets: this.sanitizeTrinkets(actions[i].opponentTrinkets),\r\n\t\t\t};\r\n\t\t\t// action.playerBoard && console.debug('\\naction playerboard', stringifySimple(action.playerBoard));\r\n\t\t\tconst lastAction = result.length > 0 ? result[result.length - 1] : null;\r\n\r\n\t\t\tif (lastAction) {\r\n\t\t\t\taction.playerBoard = action.playerBoard ?? lastAction.playerBoard;\r\n\t\t\t\taction.opponentBoard = action.opponentBoard ?? lastAction.opponentBoard;\r\n\t\t\t\taction.playerHand = action.playerHand ?? lastAction.playerHand;\r\n\t\t\t\taction.opponentHand = action.opponentHand ?? lastAction.opponentHand;\r\n\t\t\t\taction.playerSecrets = action.playerSecrets ?? lastAction.playerSecrets;\r\n\t\t\t\taction.opponentSecrets = action.opponentSecrets ?? lastAction.opponentSecrets;\r\n\t\t\t\taction.playerRewardCardId = action.playerRewardCardId ?? lastAction.playerRewardCardId;\r\n\t\t\t\taction.playerRewardEntityId = action.playerRewardEntityId ?? lastAction.playerRewardEntityId;\r\n\t\t\t\taction.playerRewardData = action.playerRewardData ?? lastAction.playerRewardData;\r\n\t\t\t\taction.opponentRewardCardId = action.opponentRewardCardId ?? lastAction.opponentRewardCardId;\r\n\t\t\t\taction.opponentRewardEntityId = action.opponentRewardEntityId ?? lastAction.opponentRewardEntityId;\r\n\t\t\t\taction.opponentRewardData = action.opponentRewardData ?? lastAction.opponentRewardData;\r\n\t\t\t\taction.playerCardId = action.playerCardId ?? lastAction.playerCardId;\r\n\t\t\t\taction.playerEntityId = action.playerEntityId ?? lastAction.playerEntityId;\r\n\t\t\t\taction.playerHeroPowerCardId = action.playerHeroPowerCardId ?? lastAction.playerHeroPowerCardId;\r\n\t\t\t\taction.playerHeroPowerEntityId = action.playerHeroPowerEntityId ?? lastAction.playerHeroPowerEntityId;\r\n\t\t\t\taction.playerHeroPowerUsed = action.playerHeroPowerUsed ?? lastAction.playerHeroPowerUsed;\r\n\t\t\t\taction.opponentCardId = action.opponentCardId ?? lastAction.opponentCardId;\r\n\t\t\t\taction.opponentEntityId = action.opponentEntityId ?? lastAction.opponentEntityId;\r\n\t\t\t\taction.opponentHeroPowerCardId = action.opponentHeroPowerCardId ?? lastAction.opponentHeroPowerCardId;\r\n\t\t\t\taction.opponentHeroPowerEntityId =\r\n\t\t\t\t\taction.opponentHeroPowerEntityId ?? lastAction.opponentHeroPowerEntityId;\r\n\t\t\t\taction.opponentHeroPowerUsed = action.opponentHeroPowerUsed ?? lastAction.opponentHeroPowerUsed;\r\n\t\t\t\taction.playerTrinkets = action.playerTrinkets ?? lastAction.playerTrinkets;\r\n\t\t\t\taction.opponentTrinkets = action.opponentTrinkets ?? lastAction.opponentTrinkets;\r\n\t\t\t}\r\n\r\n\t\t\tif (lastAction && action.type === 'damage' && lastAction.type === 'attack') {\r\n\t\t\t\tlastAction.damages = lastAction.damages || [];\r\n\t\t\t\tlastAction.damages.push({\r\n\t\t\t\t\tdamage: action.damages[0].damage,\r\n\t\t\t\t\tsourceEntityId: action.damages[0].sourceEntityId,\r\n\t\t\t\t\ttargetEntityId: action.damages[0].targetEntityId,\r\n\t\t\t\t});\r\n\t\t\t\tlastAction.playerBoard = action.playerBoard;\r\n\t\t\t\tlastAction.opponentBoard = action.opponentBoard;\r\n\t\t\t\tlastAction.playerHand = action.playerHand;\r\n\t\t\t\tlastAction.opponentHand = action.opponentHand;\r\n\t\t\t\tlastAction.playerSecrets = action.playerSecrets;\r\n\t\t\t\tlastAction.opponentSecrets = action.opponentSecrets;\r\n\t\t\t\tlastAction.playerTrinkets = action.playerTrinkets;\r\n\t\t\t\tlastAction.opponentTrinkets = action.opponentTrinkets;\r\n\t\t\t} else if (lastAction && action.type === 'damage' && lastAction.type === 'damage') {\r\n\t\t\t\tlastAction.damages = lastAction.damages || [];\r\n\t\t\t\tlastAction.damages.push({\r\n\t\t\t\t\tdamage: action.damages[0].damage,\r\n\t\t\t\t\tsourceEntityId: action.damages[0].sourceEntityId,\r\n\t\t\t\t\ttargetEntityId: action.damages[0].targetEntityId,\r\n\t\t\t\t});\r\n\t\t\t\tlastAction.playerBoard = action.playerBoard;\r\n\t\t\t\tlastAction.opponentBoard = action.opponentBoard;\r\n\t\t\t\tlastAction.playerHand = action.playerHand;\r\n\t\t\t\tlastAction.opponentHand = action.opponentHand;\r\n\t\t\t\tlastAction.playerSecrets = action.playerSecrets;\r\n\t\t\t\tlastAction.opponentSecrets = action.opponentSecrets;\r\n\t\t\t\tlastAction.playerTrinkets = action.playerTrinkets;\r\n\t\t\t\tlastAction.opponentTrinkets = action.opponentTrinkets;\r\n\t\t\t} else if (\r\n\t\t\t\tlastAction &&\r\n\t\t\t\taction.type === 'power-target' &&\r\n\t\t\t\tlastAction.type === 'power-target' &&\r\n\t\t\t\taction.sourceEntityId === lastAction.sourceEntityId\r\n\t\t\t) {\r\n\t\t\t\tlastAction.targetEntityIds =\r\n\t\t\t\t\tlastAction.targetEntityIds ?? (lastAction.targetEntityId ? [lastAction.targetEntityId] : []);\r\n\t\t\t\taction.targetEntityIds =\r\n\t\t\t\t\taction.targetEntityIds ?? (action.targetEntityId ? [action.targetEntityId] : []);\r\n\t\t\t\tlastAction.targetEntityIds.push(...action.targetEntityIds);\r\n\t\t\t\t// So that when multiple Leapfroggers enchantments target the same minion,\r\n\t\t\t\t// we can count them in the replay viewer's text\r\n\t\t\t\t// lastAction.targetEntityIds = [...new Set(lastAction.targetEntityIds)];\r\n\t\t\t\tlastAction.playerBoard = action.playerBoard;\r\n\t\t\t\tlastAction.opponentBoard = action.opponentBoard;\r\n\t\t\t\tlastAction.playerHand = action.playerHand;\r\n\t\t\t\tlastAction.opponentHand = action.opponentHand;\r\n\t\t\t\tlastAction.playerSecrets = action.playerSecrets;\r\n\t\t\t\tlastAction.opponentSecrets = action.opponentSecrets;\r\n\t\t\t\tlastAction.playerTrinkets = action.playerTrinkets;\r\n\t\t\t\tlastAction.opponentTrinkets = action.opponentTrinkets;\r\n\t\t\t} else {\r\n\t\t\t\tresult.push(action);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn result;\r\n\t}\r\n\r\n\t// Calling sanitize every time before we add an action to the list is mandatory, since\r\n\t// the entities and boards are mutable\r\n\tprivate sanitize(board: readonly BoardEntity[]): readonly BoardEntity[] {\r\n\t\tif (!board) {\r\n\t\t\treturn undefined;\r\n\t\t}\r\n\t\treturn board.map(\r\n\t\t\t(entity) =>\r\n\t\t\t\t({\r\n\t\t\t\t\tentityId: entity.entityId,\r\n\t\t\t\t\tcardId: entity.cardId,\r\n\t\t\t\t\tfriendly: entity.friendly,\r\n\t\t\t\t\tattack: entity.attack,\r\n\t\t\t\t\thealth: entity.health,\r\n\t\t\t\t\tmaxHealth: entity.maxHealth,\r\n\t\t\t\t\ttaunt: entity.taunt,\r\n\t\t\t\t\tdivineShield: entity.divineShield,\r\n\t\t\t\t\tpoisonous: entity.poisonous,\r\n\t\t\t\t\tvenomous: entity.venomous,\r\n\t\t\t\t\treborn: entity.reborn,\r\n\t\t\t\t\twindfury: entity.windfury,\r\n\t\t\t\t\tstealth: entity.stealth,\r\n\t\t\t\t} as BoardEntity),\r\n\t\t);\r\n\t}\r\n\r\n\tprivate sanitizeTrinkets(trinkets: readonly BoardTrinket[]): readonly BoardTrinket[] {\r\n\t\tif (!trinkets?.length) {\r\n\t\t\treturn undefined;\r\n\t\t}\r\n\t\treturn trinkets.map(\r\n\t\t\t(t) =>\r\n\t\t\t\t({\r\n\t\t\t\t\tcardId: t.cardId,\r\n\t\t\t\t\tentityId: t.entityId,\r\n\t\t\t\t\tscriptDataNum1: t.scriptDataNum1,\r\n\t\t\t\t\tscriptDataNum6: t.scriptDataNum6,\r\n\t\t\t\t} as BoardTrinket),\r\n\t\t);\r\n\t}\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"spectator.js","sourceRoot":"","sources":["../../../src/simulation/spectator/spectator.ts"],"names":[],"mappings":";;;AAGA,+CAA4D;AAG5D,MAAM,WAAW,GAAG,CAAC,CAAC;AAEtB,MAAa,SAAS;IAMrB;QACC,IAAI,CAAC,uBAAuB,GAAG,EAAE,CAAC;QAClC,IAAI,CAAC,UAAU,GAAG,EAAE,CAAC;QACrB,IAAI,CAAC,WAAW,GAAG,EAAE,CAAC;QACtB,IAAI,CAAC,WAAW,GAAG,EAAE,CAAC;IACvB,CAAC;IAEM,KAAK;QACX,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC;QACxD,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC;QAC1D,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC;IAC3D,CAAC;IAEM,mBAAmB;;QAKzB,OAAO;YACN,GAAG,EAAE,MAAA,IAAI,CAAC,UAAU,0CAAE,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;YAClE,IAAI,EAAE,MA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B,QAAQ,EAAE,MAAM,CAAC,QAAQ;YACzB,MAAM,EAAE,MAAM,CAAC,MAAM;YACrB,QAAQ,EAAE,MAAM,CAAC,QAAQ;YACzB,OAAO,EAAE,MAAM,CAAC,OAAO;SACP,CAAA,CAClB,CAAC;IACH,CAAC;IAEO,gBAAgB,CAAC,QAAiC;QACzD,IAAI,CAAC,CAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,MAAM,CAAA,EAAE;YACtB,OAAO,SAAS,CAAC;SACjB;QACD,MAAM,MAAM,GAAG,QAAQ,CAAC,GAAG,CAC1B,CAAC,CAAC,EAAE,EAAE,CACL,CAAC;YACA,MAAM,EAAE,CAAC,CAAC,MAAM;YAChB,QAAQ,EAAE,CAAC,CAAC,QAAQ;YACpB,cAAc,EAAE,CAAC,CAAC,cAAc;YAChC,cAAc,EAAE,CAAC,CAAC,cAAc;SACf,CAAA,CACnB,CAAC;QACF,OAAO,MAAM,CAAC;IACf,CAAC;CACD;AApaD,8BAoaC","sourcesContent":["import { BgsPlayerEntity, BoardTrinket } from '../../bgs-player-entity';\r\nimport { BoardEntity } from '../../board-entity';\r\nimport { BoardSecret } from '../../board-secret';\r\nimport { GameAction, buildGameAction } from './game-action';\r\nimport { GameSample } from './game-sample';\r\n\r\nconst MAX_SAMPLES = 1;\r\n\r\nexport class Spectator {\r\n\tprivate actionsForCurrentBattle: GameAction[];\r\n\tprivate wonBattles: GameSample[];\r\n\tprivate tiedBattles: GameSample[];\r\n\tprivate lostBattles: GameSample[];\r\n\r\n\tconstructor() {\r\n\t\tthis.actionsForCurrentBattle = [];\r\n\t\tthis.wonBattles = [];\r\n\t\tthis.tiedBattles = [];\r\n\t\tthis.lostBattles = [];\r\n\t}\r\n\r\n\tpublic prune(): void {\r\n\t\tthis.wonBattles = this.wonBattles.slice(0, MAX_SAMPLES);\r\n\t\tthis.lostBattles = this.lostBattles.slice(0, MAX_SAMPLES);\r\n\t\tthis.tiedBattles = this.tiedBattles.slice(0, MAX_SAMPLES);\r\n\t}\r\n\r\n\tpublic buildOutcomeSamples(): {\r\n\t\twon: readonly GameSample[];\r\n\t\tlost: readonly GameSample[];\r\n\t\ttied: readonly GameSample[];\r\n\t} {\r\n\t\treturn {\r\n\t\t\twon: this.wonBattles?.map((battle) => this.cleanUpActions(battle)),\r\n\t\t\tlost: this.lostBattles?.map((battle) => this.cleanUpActions(battle)),\r\n\t\t\ttied: this.tiedBattles?.map((battle) => this.cleanUpActions(battle)),\r\n\t\t};\r\n\t}\r\n\r\n\tprivate cleanUpActions(battle: GameSample): GameSample {\r\n\t\tconst collapsed = this.collapseActions(battle.actions);\r\n\t\tconst result: GameSample = {\r\n\t\t\t...battle,\r\n\t\t\tactions: collapsed,\r\n\t\t};\r\n\t\treturn result;\r\n\t}\r\n\r\n\tpublic commitBattleResult(result: 'won' | 'lost' | 'tied'): void {\r\n\t\tif (\r\n\t\t\tthis.wonBattles.length >= MAX_SAMPLES &&\r\n\t\t\tthis.lostBattles.length >= MAX_SAMPLES &&\r\n\t\t\tthis.tiedBattles.length >= MAX_SAMPLES\r\n\t\t) {\r\n\t\t\tthis.actionsForCurrentBattle = [];\r\n\t\t\treturn;\r\n\t\t}\r\n\t\t// const actionsForBattle = this.collapseActions(this.actionsForCurrentBattle);\r\n\t\tconst actionsForBattle = this.actionsForCurrentBattle;\r\n\t\tthis.actionsForCurrentBattle = [];\r\n\r\n\t\tconst battle: GameSample = {\r\n\t\t\tactions: actionsForBattle,\r\n\t\t};\r\n\t\tswitch (result) {\r\n\t\t\tcase 'won':\r\n\t\t\t\tthis.wonBattles.push(battle);\r\n\t\t\t\tbreak;\r\n\t\t\tcase 'lost':\r\n\t\t\t\tthis.lostBattles.push(battle);\r\n\t\t\t\tbreak;\r\n\t\t\tcase 'tied':\r\n\t\t\t\tthis.tiedBattles.push(battle);\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n\r\n\tpublic registerAttack(\r\n\t\tattackingEntity: BoardEntity,\r\n\t\tdefendingEntity: BoardEntity,\r\n\t\tattackingBoard: readonly BoardEntity[],\r\n\t\tdefendingBoard: readonly BoardEntity[],\r\n\t\tattackingBoardHero: BgsPlayerEntity,\r\n\t\tdefendingBoardHero: BgsPlayerEntity,\r\n\t): void {\r\n\t\t// console.debug(\r\n\t\t// \t'\\n register attack',\r\n\t\t// \tstringifySimple(attackingBoard),\r\n\t\t// \t'\\n',\r\n\t\t// \tstringifySimple(defendingBoard),\r\n\t\t// \t'\\n',\r\n\t\t// \tattackingBoard.find((e) => e.entityId === 2441),\r\n\t\t// \t'\\n',\r\n\t\t// \tattackingBoard.find((e) => e.entityId === 2442),\r\n\t\t// );\r\n\t\tconst isAttackerFriendly = attackingBoard.every((entity) => entity.friendly);\r\n\t\tconst playerHero = isAttackerFriendly ? attackingBoardHero : defendingBoardHero;\r\n\t\tconst opponentHero = isAttackerFriendly ? defendingBoardHero : attackingBoardHero;\r\n\t\tconst friendlyBoard = isAttackerFriendly ? attackingBoard : defendingBoard;\r\n\t\tconst opponentBoard = isAttackerFriendly ? defendingBoard : attackingBoard;\r\n\t\tconst action: GameAction = buildGameAction(playerHero, opponentHero, {\r\n\t\t\ttype: 'attack',\r\n\t\t\tsourceEntityId: attackingEntity.entityId,\r\n\t\t\ttargetEntityId: defendingEntity.entityId,\r\n\t\t\tplayerBoard: this.sanitize(friendlyBoard),\r\n\t\t\tplayerHand: this.sanitize(playerHero.hand),\r\n\t\t\topponentBoard: this.sanitize(opponentBoard),\r\n\t\t\topponentHand: this.sanitize(opponentHero.hand),\r\n\t\t});\r\n\t\tthis.addAction(action);\r\n\t}\r\n\r\n\tpublic registerStartOfCombat(\r\n\t\tfriendlyBoard: readonly BoardEntity[],\r\n\t\topponentBoard: readonly BoardEntity[],\r\n\t\tfriendlyHero: BgsPlayerEntity,\r\n\t\topponentHero: BgsPlayerEntity,\r\n\t): void {\r\n\t\tconst action: GameAction = buildGameAction(friendlyHero, opponentHero, {\r\n\t\t\ttype: 'start-of-combat',\r\n\t\t\tplayerBoard: this.sanitize(friendlyBoard),\r\n\t\t\topponentBoard: this.sanitize(opponentBoard),\r\n\t\t\tplayerHand: this.sanitize(friendlyHero.hand),\r\n\t\t\topponentHand: this.sanitize(opponentHero.hand),\r\n\t\t});\r\n\t\tthis.addAction(action);\r\n\t}\r\n\r\n\tpublic registerPlayerAttack(\r\n\t\tfriendlyBoard: readonly BoardEntity[],\r\n\t\topponentBoard: readonly BoardEntity[],\r\n\t\tdamage: number,\r\n\t): void {\r\n\t\tconst action: GameAction = buildGameAction(null, null, {\r\n\t\t\ttype: 'player-attack',\r\n\t\t\tplayerBoard: this.sanitize(friendlyBoard),\r\n\t\t\topponentBoard: this.sanitize(opponentBoard),\r\n\t\t\tplayerHand: null,\r\n\t\t\topponentHand: null,\r\n\t\t\tdamages: [\r\n\t\t\t\t{\r\n\t\t\t\t\tdamage: damage,\r\n\t\t\t\t},\r\n\t\t\t],\r\n\t\t});\r\n\t\tthis.addAction(action);\r\n\t}\r\n\r\n\tpublic registerOpponentAttack(\r\n\t\tfriendlyBoard: readonly BoardEntity[],\r\n\t\topponentBoard: readonly BoardEntity[],\r\n\t\tdamage: number,\r\n\t): void {\r\n\t\tconst action: GameAction = buildGameAction(null, null, {\r\n\t\t\ttype: 'opponent-attack',\r\n\t\t\tplayerBoard: this.sanitize(friendlyBoard),\r\n\t\t\topponentBoard: this.sanitize(opponentBoard),\r\n\t\t\tplayerHand: null,\r\n\t\t\topponentHand: null,\r\n\t\t\tdamages: [\r\n\t\t\t\t{\r\n\t\t\t\t\tdamage: damage,\r\n\t\t\t\t},\r\n\t\t\t],\r\n\t\t});\r\n\t\tthis.addAction(action);\r\n\t}\r\n\r\n\tpublic registerDamageDealt(\r\n\t\tdamagingEntity: BoardEntity,\r\n\t\tdamagedEntity: BoardEntity,\r\n\t\tdamageTaken: number,\r\n\t\tdamagedEntityBoard: BoardEntity[],\r\n\t): void {\r\n\t\tif (!damagingEntity.entityId) {\r\n\t\t\t// console.error('missing damaging entity id', damagingEntity.cardId);\r\n\t\t}\r\n\t\tconst friendlyBoard = damagedEntityBoard.every((entity) => entity.friendly) ? damagedEntityBoard : null;\r\n\t\tconst opponentBoard = damagedEntityBoard.every((entity) => !entity.friendly) ? damagedEntityBoard : null;\r\n\t\tconst action: GameAction = buildGameAction(null, null, {\r\n\t\t\ttype: 'damage',\r\n\t\t\tdamages: [\r\n\t\t\t\t{\r\n\t\t\t\t\tsourceEntityId: damagingEntity.entityId,\r\n\t\t\t\t\ttargetEntityId: damagedEntity.entityId,\r\n\t\t\t\t\tdamage: damageTaken,\r\n\t\t\t\t},\r\n\t\t\t],\r\n\t\t\tplayerBoard: this.sanitize(friendlyBoard),\r\n\t\t\topponentBoard: this.sanitize(opponentBoard),\r\n\t\t\tplayerHand: null,\r\n\t\t\topponentHand: null,\r\n\t\t});\r\n\t\tthis.addAction(action);\r\n\t}\r\n\r\n\tpublic registerPowerTarget(\r\n\t\tsourceEntity: BoardEntity | BgsPlayerEntity | BoardSecret | BoardTrinket,\r\n\t\ttargetEntity: BoardEntity | BgsPlayerEntity,\r\n\t\ttargetBoard: BoardEntity[],\r\n\t\thero1: BgsPlayerEntity,\r\n\t\thero2: BgsPlayerEntity,\r\n\t): void {\r\n\t\tif (!targetEntity) {\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tif (!sourceEntity.entityId && !(sourceEntity as BgsPlayerEntity).heroPowerId) {\r\n\t\t\t// console.error('missing damaging entity id', sourceEntity.cardId);\r\n\t\t}\r\n\t\t// console.log('registerPowerTarget', stringifySimpleCard(sourceEntity), stringifySimpleCard(targetEntity), new Error().stack);\r\n\t\tconst friendlyBoard = targetBoard?.every((entity) => entity.friendly) ? targetBoard : null;\r\n\t\tconst opponentBoard = targetBoard?.every((entity) => !entity.friendly) ? targetBoard : null;\r\n\t\tconst friendlyHero = hero1?.friendly ? hero1 : hero2?.friendly ? hero2 : null;\r\n\t\tconst opponentHero = hero1?.friendly ? hero2 : hero2?.friendly ? hero1 : null;\r\n\t\tconst action: GameAction = buildGameAction(friendlyHero, opponentHero, {\r\n\t\t\ttype: 'power-target',\r\n\t\t\tsourceEntityId: sourceEntity.entityId,\r\n\t\t\ttargetEntityId: targetEntity.entityId,\r\n\t\t\tplayerBoard: this.sanitize(friendlyBoard),\r\n\t\t\topponentBoard: this.sanitize(opponentBoard),\r\n\t\t\tplayerHand: this.sanitize(friendlyHero?.hand),\r\n\t\t\topponentHand: this.sanitize(opponentHero?.hand),\r\n\t\t});\r\n\t\tthis.addAction(action);\r\n\t}\r\n\r\n\tpublic registerMinionsSpawn(\r\n\t\tsourceEntity: BoardEntity | BgsPlayerEntity,\r\n\t\tboardOnWhichToSpawn: BoardEntity[],\r\n\t\tspawnedEntities: readonly BoardEntity[],\r\n\t): void {\r\n\t\tif (!spawnedEntities || spawnedEntities.length === 0) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tif (!sourceEntity?.entityId) {\r\n\t\t\t// console.error('missing spawn source entity id', sourceEntity);\r\n\t\t}\r\n\t\tconst friendlyBoard = boardOnWhichToSpawn.every((entity) => entity.friendly) ? boardOnWhichToSpawn : null;\r\n\t\tconst opponentBoard = boardOnWhichToSpawn.every((entity) => !entity.friendly) ? boardOnWhichToSpawn : null;\r\n\t\tconst action: GameAction = buildGameAction(null, null, {\r\n\t\t\ttype: 'spawn',\r\n\t\t\tspawns: this.sanitize(spawnedEntities),\r\n\t\t\tsourceEntityId: sourceEntity?.entityId,\r\n\t\t\tplayerBoard: this.sanitize(friendlyBoard),\r\n\t\t\topponentBoard: this.sanitize(opponentBoard),\r\n\t\t\tplayerHand: null,\r\n\t\t\topponentHand: null,\r\n\t\t});\r\n\t\tthis.addAction(action);\r\n\t}\r\n\r\n\tpublic registerDeadEntities(\r\n\t\tdeadMinionIndexes1: number[],\r\n\t\tdeadEntities1: BoardEntity[],\r\n\t\tboard1: BoardEntity[],\r\n\t\tdeadMinionIndexes2: number[],\r\n\t\tdeadEntities2: BoardEntity[],\r\n\t\tboard2: BoardEntity[],\r\n\t): void {\r\n\t\tconst deaths = [...(deadEntities1 || []), ...(deadEntities2 || [])];\r\n\t\tif (!deaths || deaths.length === 0) {\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tconst action: GameAction = buildGameAction(null, null, {\r\n\t\t\ttype: 'minion-death',\r\n\t\t\tdeaths: this.sanitize(deaths),\r\n\t\t\tdeadMinionsPositionsOnBoard: [\r\n\t\t\t\t...(deadMinionIndexes1 || []).map((i) => board1.length - i),\r\n\t\t\t\t...(deadMinionIndexes2 || []).map((i) => board2.length - i),\r\n\t\t\t],\r\n\t\t});\r\n\t\tthis.addAction(action);\r\n\t}\r\n\r\n\tprivate addAction(action: GameAction) {\r\n\t\tthis.actionsForCurrentBattle.push(action);\r\n\t}\r\n\r\n\tprivate collapseActions(actions: readonly GameAction[]): readonly GameAction[] {\r\n\t\tif (!actions || actions.length === 0) {\r\n\t\t\treturn [];\r\n\t\t}\r\n\t\tconst result: GameAction[] = [];\r\n\t\tfor (let i = 0; i < actions.length; i++) {\r\n\t\t\tconst action: GameAction = {\r\n\t\t\t\t...actions[i],\r\n\t\t\t\tplayerBoard: this.sanitize(actions[i].playerBoard),\r\n\t\t\t\topponentBoard: this.sanitize(actions[i].opponentBoard),\r\n\t\t\t\tplayerHand: this.sanitize(actions[i].playerHand),\r\n\t\t\t\topponentHand: this.sanitize(actions[i].opponentHand),\r\n\t\t\t\t// spawns: this.sanitize(actions[i].spawns),\r\n\t\t\t\tdeaths: this.sanitize(actions[i].deaths),\r\n\t\t\t\tplayerTrinkets: this.sanitizeTrinkets(actions[i].playerTrinkets),\r\n\t\t\t\topponentTrinkets: this.sanitizeTrinkets(actions[i].opponentTrinkets),\r\n\t\t\t};\r\n\t\t\t// action.playerBoard && console.debug('\\naction playerboard', stringifySimple(action.playerBoard));\r\n\t\t\tconst lastAction = result.length > 0 ? result[result.length - 1] : null;\r\n\r\n\t\t\tif (lastAction) {\r\n\t\t\t\taction.playerBoard = action.playerBoard ?? lastAction.playerBoard;\r\n\t\t\t\taction.opponentBoard = action.opponentBoard ?? lastAction.opponentBoard;\r\n\t\t\t\taction.playerHand = action.playerHand ?? lastAction.playerHand;\r\n\t\t\t\taction.opponentHand = action.opponentHand ?? lastAction.opponentHand;\r\n\t\t\t\taction.playerSecrets = action.playerSecrets ?? lastAction.playerSecrets;\r\n\t\t\t\taction.opponentSecrets = action.opponentSecrets ?? lastAction.opponentSecrets;\r\n\t\t\t\taction.playerRewardCardId = action.playerRewardCardId ?? lastAction.playerRewardCardId;\r\n\t\t\t\taction.playerRewardEntityId = action.playerRewardEntityId ?? lastAction.playerRewardEntityId;\r\n\t\t\t\taction.playerRewardData = action.playerRewardData ?? lastAction.playerRewardData;\r\n\t\t\t\taction.opponentRewardCardId = action.opponentRewardCardId ?? lastAction.opponentRewardCardId;\r\n\t\t\t\taction.opponentRewardEntityId = action.opponentRewardEntityId ?? lastAction.opponentRewardEntityId;\r\n\t\t\t\taction.opponentRewardData = action.opponentRewardData ?? lastAction.opponentRewardData;\r\n\t\t\t\taction.playerCardId = action.playerCardId ?? lastAction.playerCardId;\r\n\t\t\t\taction.playerEntityId = action.playerEntityId ?? lastAction.playerEntityId;\r\n\t\t\t\taction.playerHeroPowerCardId = action.playerHeroPowerCardId ?? lastAction.playerHeroPowerCardId;\r\n\t\t\t\taction.playerHeroPowerEntityId = action.playerHeroPowerEntityId ?? lastAction.playerHeroPowerEntityId;\r\n\t\t\t\taction.playerHeroPowerUsed = action.playerHeroPowerUsed ?? lastAction.playerHeroPowerUsed;\r\n\t\t\t\taction.opponentCardId = action.opponentCardId ?? lastAction.opponentCardId;\r\n\t\t\t\taction.opponentEntityId = action.opponentEntityId ?? lastAction.opponentEntityId;\r\n\t\t\t\taction.opponentHeroPowerCardId = action.opponentHeroPowerCardId ?? lastAction.opponentHeroPowerCardId;\r\n\t\t\t\taction.opponentHeroPowerEntityId =\r\n\t\t\t\t\taction.opponentHeroPowerEntityId ?? lastAction.opponentHeroPowerEntityId;\r\n\t\t\t\taction.opponentHeroPowerUsed = action.opponentHeroPowerUsed ?? lastAction.opponentHeroPowerUsed;\r\n\t\t\t\taction.playerTrinkets = action.playerTrinkets ?? lastAction.playerTrinkets;\r\n\t\t\t\taction.opponentTrinkets = action.opponentTrinkets ?? lastAction.opponentTrinkets;\r\n\t\t\t}\r\n\r\n\t\t\tif (lastAction && action.type === 'damage' && lastAction.type === 'attack') {\r\n\t\t\t\tlastAction.damages = lastAction.damages || [];\r\n\t\t\t\tlastAction.damages.push({\r\n\t\t\t\t\tdamage: action.damages[0].damage,\r\n\t\t\t\t\tsourceEntityId: action.damages[0].sourceEntityId,\r\n\t\t\t\t\ttargetEntityId: action.damages[0].targetEntityId,\r\n\t\t\t\t});\r\n\t\t\t\tlastAction.playerBoard = action.playerBoard;\r\n\t\t\t\tlastAction.opponentBoard = action.opponentBoard;\r\n\t\t\t\tlastAction.playerHand = action.playerHand;\r\n\t\t\t\tlastAction.opponentHand = action.opponentHand;\r\n\t\t\t\tlastAction.playerSecrets = action.playerSecrets;\r\n\t\t\t\tlastAction.opponentSecrets = action.opponentSecrets;\r\n\t\t\t\tlastAction.playerTrinkets = action.playerTrinkets;\r\n\t\t\t\tlastAction.opponentTrinkets = action.opponentTrinkets;\r\n\t\t\t} else if (lastAction && action.type === 'damage' && lastAction.type === 'damage') {\r\n\t\t\t\tlastAction.damages = lastAction.damages || [];\r\n\t\t\t\tlastAction.damages.push({\r\n\t\t\t\t\tdamage: action.damages[0].damage,\r\n\t\t\t\t\tsourceEntityId: action.damages[0].sourceEntityId,\r\n\t\t\t\t\ttargetEntityId: action.damages[0].targetEntityId,\r\n\t\t\t\t});\r\n\t\t\t\tlastAction.playerBoard = action.playerBoard;\r\n\t\t\t\tlastAction.opponentBoard = action.opponentBoard;\r\n\t\t\t\tlastAction.playerHand = action.playerHand;\r\n\t\t\t\tlastAction.opponentHand = action.opponentHand;\r\n\t\t\t\tlastAction.playerSecrets = action.playerSecrets;\r\n\t\t\t\tlastAction.opponentSecrets = action.opponentSecrets;\r\n\t\t\t\tlastAction.playerTrinkets = action.playerTrinkets;\r\n\t\t\t\tlastAction.opponentTrinkets = action.opponentTrinkets;\r\n\t\t\t} else if (\r\n\t\t\t\tlastAction &&\r\n\t\t\t\taction.type === 'power-target' &&\r\n\t\t\t\tlastAction.type === 'power-target' &&\r\n\t\t\t\taction.sourceEntityId === lastAction.sourceEntityId\r\n\t\t\t) {\r\n\t\t\t\tlastAction.targetEntityIds =\r\n\t\t\t\t\tlastAction.targetEntityIds ?? (lastAction.targetEntityId ? [lastAction.targetEntityId] : []);\r\n\t\t\t\taction.targetEntityIds =\r\n\t\t\t\t\taction.targetEntityIds ?? (action.targetEntityId ? [action.targetEntityId] : []);\r\n\t\t\t\tlastAction.targetEntityIds.push(...action.targetEntityIds);\r\n\t\t\t\t// So that when multiple Leapfroggers enchantments target the same minion,\r\n\t\t\t\t// we can count them in the replay viewer's text\r\n\t\t\t\t// lastAction.targetEntityIds = [...new Set(lastAction.targetEntityIds)];\r\n\t\t\t\tlastAction.playerBoard = action.playerBoard;\r\n\t\t\t\tlastAction.opponentBoard = action.opponentBoard;\r\n\t\t\t\tlastAction.playerHand = action.playerHand;\r\n\t\t\t\tlastAction.opponentHand = action.opponentHand;\r\n\t\t\t\tlastAction.playerSecrets = action.playerSecrets;\r\n\t\t\t\tlastAction.opponentSecrets = action.opponentSecrets;\r\n\t\t\t\tlastAction.playerTrinkets = action.playerTrinkets;\r\n\t\t\t\tlastAction.opponentTrinkets = action.opponentTrinkets;\r\n\t\t\t} else {\r\n\t\t\t\tresult.push(action);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn result;\r\n\t}\r\n\r\n\t// Calling sanitize every time before we add an action to the list is mandatory, since\r\n\t// the entities and boards are mutable\r\n\tprivate sanitize(board: readonly BoardEntity[]): readonly BoardEntity[] {\r\n\t\tif (!board) {\r\n\t\t\treturn undefined;\r\n\t\t}\r\n\t\treturn board.map(\r\n\t\t\t(entity) =>\r\n\t\t\t\t({\r\n\t\t\t\t\tentityId: entity.entityId,\r\n\t\t\t\t\tcardId: entity.cardId,\r\n\t\t\t\t\tfriendly: entity.friendly,\r\n\t\t\t\t\tattack: entity.attack,\r\n\t\t\t\t\thealth: entity.health,\r\n\t\t\t\t\tmaxHealth: entity.maxHealth,\r\n\t\t\t\t\ttaunt: entity.taunt,\r\n\t\t\t\t\tdivineShield: entity.divineShield,\r\n\t\t\t\t\tpoisonous: entity.poisonous,\r\n\t\t\t\t\tvenomous: entity.venomous,\r\n\t\t\t\t\treborn: entity.reborn,\r\n\t\t\t\t\twindfury: entity.windfury,\r\n\t\t\t\t\tstealth: entity.stealth,\r\n\t\t\t\t} as BoardEntity),\r\n\t\t);\r\n\t}\r\n\r\n\tprivate sanitizeTrinkets(trinkets: readonly BoardTrinket[]): readonly BoardTrinket[] {\r\n\t\tif (!trinkets?.length) {\r\n\t\t\treturn undefined;\r\n\t\t}\r\n\t\tconst result = trinkets.map(\r\n\t\t\t(t) =>\r\n\t\t\t\t({\r\n\t\t\t\t\tcardId: t.cardId,\r\n\t\t\t\t\tentityId: t.entityId,\r\n\t\t\t\t\tscriptDataNum1: t.scriptDataNum1,\r\n\t\t\t\t\tscriptDataNum6: t.scriptDataNum6,\r\n\t\t\t\t} as BoardTrinket),\r\n\t\t);\r\n\t\treturn result;\r\n\t}\r\n}\r\n"]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { BgsPlayerEntity, BoardTrinket } from '../../bgs-player-entity';
|
|
2
2
|
import { BoardEntity } from '../../board-entity';
|
|
3
|
+
import { BoardSecret } from '../../board-secret';
|
|
3
4
|
import { StartOfCombatTiming } from '../../cards/card.interface';
|
|
4
5
|
import { SoCInput } from './start-of-combat-input';
|
|
5
|
-
export declare const performStartOfCombatAction: (cardId: string, entity: BoardEntity | BoardTrinket | BgsPlayerEntity, input: SoCInput, timing?: StartOfCombatTiming) => boolean;
|
|
6
|
+
export declare const performStartOfCombatAction: (cardId: string, entity: BoardEntity | BoardTrinket | BgsPlayerEntity | BoardSecret, input: SoCInput, processDeaths: boolean, timing?: StartOfCombatTiming) => boolean;
|
|
@@ -3,6 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.performStartOfCombatAction = void 0;
|
|
4
4
|
const anomalous_twin_1 = require("../../cards/impl/anomaly/anomalous-twin");
|
|
5
5
|
const blessed_or_blighted_1 = require("../../cards/impl/anomaly/blessed-or-blighted");
|
|
6
|
+
const boon_of_beetles_1 = require("../../cards/impl/bg-spell/boon-of-beetles");
|
|
7
|
+
const toxic_tumbleweed_1 = require("../../cards/impl/bg-spell/toxic-tumbleweed");
|
|
8
|
+
const upper_hand_1 = require("../../cards/impl/bg-spell/upper-hand");
|
|
6
9
|
const aim_high_1 = require("../../cards/impl/hero-power/aim-high");
|
|
7
10
|
const aim_left_1 = require("../../cards/impl/hero-power/aim-left");
|
|
8
11
|
const aim_low_1 = require("../../cards/impl/hero-power/aim-low");
|
|
@@ -50,6 +53,7 @@ const yulon_fortune_granter_1 = require("../../cards/impl/minion/yulon-fortune-g
|
|
|
50
53
|
const evil_twin_1 = require("../../cards/impl/quest-reward/evil-twin");
|
|
51
54
|
const staff_of_origination_1 = require("../../cards/impl/quest-reward/staff-of-origination");
|
|
52
55
|
const stolen_gold_1 = require("../../cards/impl/quest-reward/stolen-gold");
|
|
56
|
+
const fleeting_vigor_1 = require("../../cards/impl/spell/fleeting-vigor");
|
|
53
57
|
const artisanal_urn_1 = require("../../cards/impl/trinket/artisanal-urn");
|
|
54
58
|
const automaton_portrait_1 = require("../../cards/impl/trinket/automaton-portrait");
|
|
55
59
|
const bronze_timepiece_1 = require("../../cards/impl/trinket/bronze-timepiece");
|
|
@@ -68,7 +72,8 @@ const summoning_sphere_1 = require("../../cards/impl/trinket/summoning-sphere");
|
|
|
68
72
|
const tinyfin_onesie_1 = require("../../cards/impl/trinket/tinyfin-onesie");
|
|
69
73
|
const training_certificate_1 = require("../../cards/impl/trinket/training-certificate");
|
|
70
74
|
const valorous_medaillion_1 = require("../../cards/impl/trinket/valorous-medaillion");
|
|
71
|
-
const
|
|
75
|
+
const attack_1 = require("../attack");
|
|
76
|
+
const performStartOfCombatAction = (cardId, entity, input, processDeaths, timing) => {
|
|
72
77
|
let hasTriggered = false;
|
|
73
78
|
const promoPortraitCount = getPromoPortraitCount(input.playerEntity);
|
|
74
79
|
for (let i = promoPortraitCount; i >= 0; i--) {
|
|
@@ -79,8 +84,11 @@ const performStartOfCombatAction = (cardId, entity, input, timing) => {
|
|
|
79
84
|
const action = card === null || card === void 0 ? void 0 : card.startOfCombat;
|
|
80
85
|
if (!!action) {
|
|
81
86
|
hasTriggered = action(entity, input);
|
|
87
|
+
onStartOfCombatTriggered(i, cardId, input.playerEntity);
|
|
82
88
|
if (!!hasTriggered) {
|
|
83
|
-
|
|
89
|
+
if (processDeaths) {
|
|
90
|
+
(0, attack_1.processMinionDeath)(input.playerBoard, input.playerEntity, input.opponentBoard, input.opponentEntity, input.gameState);
|
|
91
|
+
}
|
|
84
92
|
if (typeof hasTriggered !== 'boolean' && hasTriggered.shouldRecomputeCurrentAttacker) {
|
|
85
93
|
input.currentAttacker =
|
|
86
94
|
input.playerBoard.length > input.opponentBoard.length
|
|
@@ -184,6 +192,14 @@ const getStartOfCombatAction = (cardId) => {
|
|
|
184
192
|
return blessed_or_blighted_1.BlessedOrBlighted;
|
|
185
193
|
case "BG27_Anomaly_560":
|
|
186
194
|
return anomalous_twin_1.AnomalousTwin;
|
|
195
|
+
case "BG28_603":
|
|
196
|
+
return boon_of_beetles_1.BoonOfBeetles;
|
|
197
|
+
case "BG28_641":
|
|
198
|
+
return toxic_tumbleweed_1.ToxicTumbleweed;
|
|
199
|
+
case "BG28_573":
|
|
200
|
+
return upper_hand_1.UpperHand;
|
|
201
|
+
case "BG28_519":
|
|
202
|
+
return fleeting_vigor_1.FleetingVigor;
|
|
187
203
|
case "BGS_019":
|
|
188
204
|
case "TB_BaconUps_102":
|
|
189
205
|
return red_whelp_1.RedWhelp;
|
|
@@ -271,7 +287,7 @@ const getStartOfCombatAction = (cardId) => {
|
|
|
271
287
|
};
|
|
272
288
|
const onStartOfCombatTriggered = (iteration, triggeredCardId, playerEntity) => {
|
|
273
289
|
const promoPortraits = playerEntity.trinkets.filter((t) => t.cardId === "BG30_MagicItem_918" && t.scriptDataNum1 > 0);
|
|
274
|
-
if (promoPortraits.length === 0 || iteration === 0 || iteration
|
|
290
|
+
if (promoPortraits.length === 0 || iteration === 0 || iteration > promoPortraits.length) {
|
|
275
291
|
return;
|
|
276
292
|
}
|
|
277
293
|
switch (triggeredCardId) {
|
|
@@ -282,6 +298,7 @@ const onStartOfCombatTriggered = (iteration, triggeredCardId, playerEntity) => {
|
|
|
282
298
|
case "BG30_MagicItem_995":
|
|
283
299
|
case "TB_BaconShop_HP_086":
|
|
284
300
|
case "TB_BaconShop_HP_024":
|
|
301
|
+
case "BG28_603":
|
|
285
302
|
return;
|
|
286
303
|
}
|
|
287
304
|
const promoPortrait = promoPortraits[iteration - 1];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"soc-action-processor.js","sourceRoot":"","sources":["../../../src/simulation/start-of-combat/soc-action-processor.ts"],"names":[],"mappings":";;;AAIA,4EAAwE;AACxE,sFAAiF;AACjF,mEAA+D;AAC/D,mEAA+D;AAC/D,iEAA6D;AAC7D,qEAAiE;AACjE,6EAAwE;AACxE,mFAA+E;AAC/E,qFAAgF;AAChF,iFAA6E;AAC7E,yFAAqF;AACrF,+EAA2E;AAC3E,2FAAuF;AACvF,qFAAiF;AACjF,2EAAuE;AACvE,mFAA+E;AAC/E,uEAAoE;AACpE,mFAA+E;AAC/E,yEAAqE;AACrE,2EAAuE;AACvE,+EAA2E;AAC3E,yEAAqE;AACrE,2EAAuE;AACvE,mFAA+E;AAC/E,2DAAwD;AACxD,+EAA2E;AAC3E,2EAAuE;AACvE,mFAA+E;AAC/E,mFAA+E;AAC/E,uEAAmE;AACnE,2FAAuF;A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e,EAAE;QACxB,uBAAwB;QACxB,0BAA2C;QAC3C,0BAAoD;QACpD,0BAAgD;QAChD,0BAAgD;QAChD,2BAA6B;QAC7B;YACC,OAAO;KACR;IAED,MAAM,aAAa,GAAG,cAAc,CAAC,SAAS,GAAG,CAAC,CAAC,CAAC;IACpD,aAAa,CAAC,cAAc,EAAE,CAAC;AAChC,CAAC,CAAC;AAEF,MAAM,qBAAqB,GAAG,CAAC,YAA6B,EAAE,EAAE;IAC/D,OAAO,YAAY,CAAC,QAAQ,CAAC,MAAM,CAClC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,yBAA6C,IAAI,CAAC,CAAC,cAAc,GAAG,CAAC,CACpF,CAAC,MAAM,CAAC;AACV,CAAC,CAAC","sourcesContent":["import { CardIds } from '@firestone-hs/reference-data';\r\nimport { BgsPlayerEntity, BoardTrinket } from '../../bgs-player-entity';\r\nimport { BoardEntity } from '../../board-entity';\r\nimport { StartOfCombatCard, StartOfCombatTiming } from '../../cards/card.interface';\r\nimport { AnomalousTwin } from '../../cards/impl/anomaly/anomalous-twin';\r\nimport { BlessedOrBlighted } from '../../cards/impl/anomaly/blessed-or-blighted';\r\nimport { AimHigh } from '../../cards/impl/hero-power/aim-high';\r\nimport { AimLeft } from '../../cards/impl/hero-power/aim-left';\r\nimport { AimLow } from '../../cards/impl/hero-power/aim-low';\r\nimport { AimRight } from '../../cards/impl/hero-power/aim-right';\r\nimport { AllWillBurn } from '../../cards/impl/hero-power/all-will-burn';\r\nimport { EarthInvocation } from '../../cards/impl/hero-power/earth-invocation';\r\nimport { EmbraceYourRage } from '../../cards/impl/hero-power/embrace-your-rage';\r\nimport { FireInvocation } from '../../cards/impl/hero-power/fire-invocation';\r\nimport { FragrantPhylactery } from '../../cards/impl/hero-power/fragrant-phylactery';\r\nimport { GloriousGloop } from '../../cards/impl/hero-power/glorious-gloop';\r\nimport { LightningInvocation } from '../../cards/impl/hero-power/lightning-invocation';\r\nimport { RapidReanimation } from '../../cards/impl/hero-power/rapid-reanimation';\r\nimport { RebornRites } from '../../cards/impl/hero-power/reborn-rites';\r\nimport { SwattingInsects } from '../../cards/impl/hero-power/swatting-insects';\r\nimport { Tentacular } from '../../cards/impl/hero-power/tentacular';\r\nimport { WaterInvocation } from '../../cards/impl/hero-power/water-invocation';\r\nimport { WaxWarband } from '../../cards/impl/hero-power/wax-warband';\r\nimport { AmberGuardian } from '../../cards/impl/minion/amber-guardian';\r\nimport { AudaciousAnchor } from '../../cards/impl/minion/audacious-anchor';\r\nimport { CarbonicCopy } from '../../cards/impl/minion/carbonic-copy';\r\nimport { ChoralMrrrglr } from '../../cards/impl/minion/choral-mrrrglr';\r\nimport { CorruptedMyrmidon } from '../../cards/impl/minion/corrupted-myrmidon';\r\nimport { Crabby } from '../../cards/impl/minion/crabby';\r\nimport { DiremuckForager } from '../../cards/impl/minion/diremuck-forager';\r\nimport { ElderTaggawag } from '../../cards/impl/minion/elder-taggawag';\r\nimport { HawkstriderHerald } from '../../cards/impl/minion/hawkstrider-herald';\r\nimport { HoardingHatespawn } from '../../cards/impl/minion/hoarding-hatespawn';\r\nimport { HummingBird } from '../../cards/impl/minion/humming-bird';\r\nimport { InterrogatorWhitemane } from '../../cards/impl/minion/interrogator-whitemane';\r\nimport { IrateRooster } from '../../cards/impl/minion/irate-rooster';\r\nimport { MantidQueen } from '../../cards/impl/minion/mantid-queen';\r\nimport { MisfitDragonling } from '../../cards/impl/minion/misfit-dragonling';\r\nimport { PilotedWhirlOTron } from '../../cards/impl/minion/piloted-whirl-o-tron';\r\nimport { PrizedPromoDrake } from '../../cards/impl/minion/prized-promo-drake';\r\nimport { RedWhelp } from '../../cards/impl/minion/red-whelp';\r\nimport { SanctumRester } from '../../cards/impl/minion/sanctum-rester';\r\nimport { Sandy } from '../../cards/impl/minion/sandy';\r\nimport { SkyPirateFlagbearer } from '../../cards/impl/minion/sky-pirate-flagbearer';\r\nimport { Soulsplitter } from '../../cards/impl/minion/soulsplitter';\r\nimport { SunScreener } from '../../cards/impl/minion/sun-screener';\r\nimport { TheUninvitedGuest } from '../../cards/impl/minion/the-uninvited-guest';\r\nimport { ThousandthPaperDrake } from '../../cards/impl/minion/thousandth-paper-drake';\r\nimport { Vaelastrasz } from '../../cards/impl/minion/vaelastrasz';\r\nimport { YulonFortuneGranter } from '../../cards/impl/minion/yulon-fortune-granter';\r\nimport { EvilTwin } from '../../cards/impl/quest-reward/evil-twin';\r\nimport { StaffOfOrigination } from '../../cards/impl/quest-reward/staff-of-origination';\r\nimport { StolenGold } from '../../cards/impl/quest-reward/stolen-gold';\r\nimport { ArtisanalUrn } from '../../cards/impl/trinket/artisanal-urn';\r\nimport { AutomatonPortrait } from '../../cards/impl/trinket/automaton-portrait';\r\nimport { BronzeTimepiece } from '../../cards/impl/trinket/bronze-timepiece';\r\nimport { EmeraldDreamcatcher } from '../../cards/impl/trinket/emerald-dreamcatcher';\r\nimport { EternalPortrait } from '../../cards/impl/trinket/eternal-portrait';\r\nimport { FishySticker } from '../../cards/impl/trinket/fishy-sticker';\r\nimport { HoggyBank } from '../../cards/impl/trinket/hoggy-bank';\r\nimport { HollyMallet } from '../../cards/impl/trinket/holly-mallet';\r\nimport { IronforgeAnvil } from '../../cards/impl/trinket/ironforge-anvil';\r\nimport { JarredFrostling } from '../../cards/impl/trinket/jarred-frostling';\r\nimport { KarazhanChessSet } from '../../cards/impl/trinket/karazhan-chess-set';\r\nimport { RivendarePortrait } from '../../cards/impl/trinket/rivendare-portrait';\r\nimport { RustyTrident } from '../../cards/impl/trinket/rusty-trident';\r\nimport { ShipInABottle } from '../../cards/impl/trinket/ship-in-a-bottle';\r\nimport { SummoningSphere } from '../../cards/impl/trinket/summoning-sphere';\r\nimport { TinyfinOnesie } from '../../cards/impl/trinket/tinyfin-onesie';\r\nimport { TrainingCertificate } from '../../cards/impl/trinket/training-certificate';\r\nimport { ValorousMedallion } from '../../cards/impl/trinket/valorous-medaillion';\r\nimport { SoCInput } from './start-of-combat-input';\r\n\r\nexport const performStartOfCombatAction = (\r\n\tcardId: string,\r\n\tentity: BoardEntity | BoardTrinket | BgsPlayerEntity,\r\n\tinput: SoCInput,\r\n\ttiming?: StartOfCombatTiming,\r\n) => {\r\n\tlet hasTriggered:\r\n\t\t| boolean\r\n\t\t| {\r\n\t\t\t\thasTriggered: boolean;\r\n\t\t\t\tshouldRecomputeCurrentAttacker: boolean;\r\n\t\t } = false;\r\n\tconst promoPortraitCount = getPromoPortraitCount(input.playerEntity);\r\n\tfor (let i = promoPortraitCount; i >= 0; i--) {\r\n\t\tconst card = getStartOfCombatAction(cardId);\r\n\t\tif (!!timing && card?.startOfCombatTiming !== timing) {\r\n\t\t\treturn false;\r\n\t\t}\r\n\r\n\t\tconst action = card?.startOfCombat;\r\n\t\tif (!!action) {\r\n\t\t\thasTriggered = action(entity, input);\r\n\t\t\tif (!!hasTriggered) {\r\n\t\t\t\tonStartOfCombatTriggered(i, cardId, input.playerEntity);\r\n\t\t\t\tif (typeof hasTriggered !== 'boolean' && hasTriggered.shouldRecomputeCurrentAttacker) {\r\n\t\t\t\t\tinput.currentAttacker =\r\n\t\t\t\t\t\tinput.playerBoard.length > input.opponentBoard.length\r\n\t\t\t\t\t\t\t? input.playerIsFriendly\r\n\t\t\t\t\t\t\t\t? 0\r\n\t\t\t\t\t\t\t\t: 1\r\n\t\t\t\t\t\t\t: input.opponentBoard.length > input.playerBoard.length\r\n\t\t\t\t\t\t\t? input.playerIsFriendly\r\n\t\t\t\t\t\t\t\t? 1\r\n\t\t\t\t\t\t\t\t: 0\r\n\t\t\t\t\t\t\t: Math.round(Math.random());\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn !!hasTriggered;\r\n};\r\n\r\n// TODO: load all cards on start, then do some programmatic mapping\r\nconst getStartOfCombatAction = (cardId: string): StartOfCombatCard => {\r\n\tswitch (cardId) {\r\n\t\t// Quest rewards\r\n\t\tcase CardIds.EvilTwin:\r\n\t\t\treturn EvilTwin;\r\n\t\tcase CardIds.StaffOfOrigination_BG24_Reward_312:\r\n\t\t\treturn StaffOfOrigination;\r\n\t\tcase CardIds.StolenGold:\r\n\t\t\treturn StolenGold;\r\n\r\n\t\t// Trinkets\r\n\t\tcase CardIds.HolyMallet_BG30_MagicItem_902:\r\n\t\t\treturn HollyMallet;\r\n\t\tcase CardIds.TrainingCertificate_BG30_MagicItem_962:\r\n\t\t\treturn TrainingCertificate;\r\n\t\tcase CardIds.ValorousMedallion_BG30_MagicItem_970:\r\n\t\tcase CardIds.ValorousMedallion_ValorousMedallionToken_BG30_MagicItem_970t:\r\n\t\t\treturn ValorousMedallion;\r\n\t\tcase CardIds.EmeraldDreamcatcher_BG30_MagicItem_542:\r\n\t\t\treturn EmeraldDreamcatcher;\r\n\t\tcase CardIds.JarredFrostling_BG30_MagicItem_952:\r\n\t\t\treturn JarredFrostling;\r\n\t\tcase CardIds.RustyTrident_BG30_MagicItem_917:\r\n\t\t\treturn RustyTrident;\r\n\t\tcase CardIds.HoggyBank_BG30_MagicItem_411:\r\n\t\t\treturn HoggyBank;\r\n\t\tcase CardIds.AutomatonPortrait_BG30_MagicItem_303:\r\n\t\t\treturn AutomatonPortrait;\r\n\t\tcase CardIds.ShipInABottle_BG30_MagicItem_407:\r\n\t\t\treturn ShipInABottle;\r\n\t\tcase CardIds.EternalPortrait_BG30_MagicItem_301:\r\n\t\t\treturn EternalPortrait;\r\n\t\tcase CardIds.ArtisanalUrn_BG30_MagicItem_989:\r\n\t\tcase CardIds.ArtisanalUrn_ArtisanalUrnToken_BG30_MagicItem_989t:\r\n\t\t\treturn ArtisanalUrn;\r\n\t\tcase CardIds.RivendarePortrait_BG30_MagicItem_310:\r\n\t\t\treturn RivendarePortrait;\r\n\t\tcase CardIds.TinyfinOnesie_BG30_MagicItem_441:\r\n\t\t\treturn TinyfinOnesie;\r\n\t\tcase CardIds.BronzeTimepiece_BG30_MagicItem_995:\r\n\t\t\treturn BronzeTimepiece;\r\n\t\tcase CardIds.IronforgeAnvil_BG30_MagicItem_403:\r\n\t\t\treturn IronforgeAnvil;\r\n\t\tcase CardIds.KarazhanChessSet_BG30_MagicItem_972:\r\n\t\t\treturn KarazhanChessSet;\r\n\t\tcase CardIds.FishySticker_BG30_MagicItem_821:\r\n\t\tcase CardIds.FishySticker_FishyStickerToken_BG30_MagicItem_821t2:\r\n\t\t\treturn FishySticker;\r\n\t\tcase CardIds.SummoningSphere_BGDUO_MagicItem_003:\r\n\t\t\treturn SummoningSphere;\r\n\r\n\t\t// Hero powers\r\n\t\tcase CardIds.SwattingInsects:\r\n\t\t\treturn SwattingInsects;\r\n\t\tcase CardIds.EarthInvocationToken:\r\n\t\t\treturn EarthInvocation;\r\n\t\tcase CardIds.WaterInvocationToken:\r\n\t\t\treturn WaterInvocation;\r\n\t\tcase CardIds.FireInvocationToken:\r\n\t\t\treturn FireInvocation;\r\n\t\tcase CardIds.LightningInvocationToken:\r\n\t\t\treturn LightningInvocation;\r\n\t\tcase CardIds.AllWillBurn:\r\n\t\t\treturn AllWillBurn;\r\n\t\tcase CardIds.TamsinRoame_FragrantPhylactery:\r\n\t\t\treturn FragrantPhylactery;\r\n\t\tcase CardIds.EmbraceYourRage:\r\n\t\t\treturn EmbraceYourRage;\r\n\t\tcase CardIds.Ozumat_Tentacular:\r\n\t\t\treturn Tentacular;\r\n\t\tcase CardIds.RebornRites:\r\n\t\t\treturn RebornRites;\r\n\t\tcase CardIds.TeronGorefiend_RapidReanimation:\r\n\t\t\treturn RapidReanimation;\r\n\t\tcase CardIds.WaxWarband:\r\n\t\t\treturn WaxWarband;\r\n\t\tcase CardIds.FlobbidinousFloop_GloriousGloop_BGDUO_HERO_101p:\r\n\t\t\treturn GloriousGloop;\r\n\t\tcase CardIds.AimLeftToken:\r\n\t\t\treturn AimLeft;\r\n\t\tcase CardIds.AimRightToken:\r\n\t\t\treturn AimRight;\r\n\t\tcase CardIds.AimLowToken:\r\n\t\t\treturn AimLow;\r\n\t\tcase CardIds.AimHighToken:\r\n\t\t\treturn AimHigh;\r\n\r\n\t\t// Anomalies\r\n\t\tcase CardIds.BlessedOrBlighted_BG27_Anomaly_726:\r\n\t\t\treturn BlessedOrBlighted;\r\n\t\tcase CardIds.AnomalousTwin_BG27_Anomaly_560:\r\n\t\t\treturn AnomalousTwin;\r\n\r\n\t\t// Minions\r\n\t\tcase CardIds.RedWhelp_BGS_019:\r\n\t\tcase CardIds.RedWhelp_TB_BaconUps_102:\r\n\t\t\treturn RedWhelp;\r\n\t\tcase CardIds.PrizedPromoDrake_BG21_014:\r\n\t\tcase CardIds.PrizedPromoDrake_BG21_014_G:\r\n\t\t\treturn PrizedPromoDrake;\r\n\t\tcase CardIds.ChoralMrrrglr_BG26_354:\r\n\t\tcase CardIds.ChoralMrrrglr_BG26_354_G:\r\n\t\t\treturn ChoralMrrrglr;\r\n\t\tcase CardIds.AmberGuardian_BG24_500:\r\n\t\tcase CardIds.AmberGuardian_BG24_500_G:\r\n\t\t\treturn AmberGuardian;\r\n\t\tcase CardIds.SanctumRester_BG26_356:\r\n\t\tcase CardIds.SanctumRester_BG26_356_G:\r\n\t\t\treturn SanctumRester;\r\n\t\tcase CardIds.Soulsplitter_BG25_023:\r\n\t\tcase CardIds.Soulsplitter_BG25_023_G:\r\n\t\t\treturn Soulsplitter;\r\n\t\tcase CardIds.Crabby_BG22_HERO_000_Buddy:\r\n\t\tcase CardIds.Crabby_BG22_HERO_000_Buddy_G:\r\n\t\t\treturn Crabby;\r\n\t\tcase CardIds.CorruptedMyrmidon_BG23_012:\r\n\t\tcase CardIds.CorruptedMyrmidon_BG23_012_G:\r\n\t\t\treturn CorruptedMyrmidon;\r\n\t\tcase CardIds.InterrogatorWhitemane_BG24_704:\r\n\t\tcase CardIds.InterrogatorWhitemane_BG24_704_G:\r\n\t\t\treturn InterrogatorWhitemane;\r\n\t\tcase CardIds.MantidQueen_BG22_402:\r\n\t\tcase CardIds.MantidQueen_BG22_402_G:\r\n\t\t\treturn MantidQueen;\r\n\t\tcase CardIds.CarbonicCopy_BG27_503:\r\n\t\tcase CardIds.CarbonicCopy_BG27_503_G:\r\n\t\t\treturn CarbonicCopy;\r\n\t\tcase CardIds.DiremuckForager_BG27_556:\r\n\t\tcase CardIds.DiremuckForager_BG27_556_G:\r\n\t\t\treturn DiremuckForager;\r\n\t\tcase CardIds.HawkstriderHerald_BG27_079:\r\n\t\tcase CardIds.HawkstriderHerald_BG27_079_G:\r\n\t\t\treturn HawkstriderHerald;\r\n\t\tcase CardIds.AudaciousAnchor_BG28_904:\r\n\t\tcase CardIds.AudaciousAnchor_BG28_904_G:\r\n\t\t\treturn AudaciousAnchor;\r\n\t\tcase CardIds.PilotedWhirlOTron_BG21_HERO_030_Buddy:\r\n\t\tcase CardIds.PilotedWhirlOTron_BG21_HERO_030_Buddy_G:\r\n\t\t\treturn PilotedWhirlOTron;\r\n\t\tcase CardIds.IrateRooster_BG29_990:\r\n\t\tcase CardIds.IrateRooster_BG29_990_G:\r\n\t\t\treturn IrateRooster;\r\n\t\tcase CardIds.MisfitDragonling_BG29_814:\r\n\t\tcase CardIds.MisfitDragonling_BG29_814_G:\r\n\t\t\treturn MisfitDragonling;\r\n\t\tcase CardIds.ThousandthPaperDrake_BG29_810:\r\n\t\tcase CardIds.ThousandthPaperDrake_BG29_810_G:\r\n\t\t\treturn ThousandthPaperDrake;\r\n\t\tcase CardIds.YulonFortuneGranter_BG29_811:\r\n\t\tcase CardIds.YulonFortuneGranter_BG29_811_G:\r\n\t\t\treturn YulonFortuneGranter;\r\n\t\tcase CardIds.HoardingHatespawn_BG29_872:\r\n\t\tcase CardIds.HoardingHatespawn_BG29_872_G:\r\n\t\t\treturn HoardingHatespawn;\r\n\t\tcase CardIds.TheUninvitedGuest_BG29_875:\r\n\t\tcase CardIds.TheUninvitedGuest_BG29_875_G:\r\n\t\t\treturn TheUninvitedGuest;\r\n\t\tcase CardIds.Sandy_BGDUO_125:\r\n\t\tcase CardIds.Sandy_BGDUO_125_G:\r\n\t\t\treturn Sandy;\r\n\t\tcase CardIds.Vaelastrasz_TB_BaconShop_HERO_56_Buddy:\r\n\t\tcase CardIds.Vaelastrasz_TB_BaconShop_HERO_56_Buddy_G:\r\n\t\t\treturn Vaelastrasz;\r\n\t\tcase CardIds.ElderTaggawag_TB_BaconShop_HERO_14_Buddy:\r\n\t\tcase CardIds.ElderTaggawag_TB_BaconShop_HERO_14_Buddy_G:\r\n\t\t\treturn ElderTaggawag;\r\n\t\tcase CardIds.SunScreener_BG30_101:\r\n\t\tcase CardIds.SunScreener_BG30_101_G:\r\n\t\t\treturn SunScreener;\r\n\t\tcase CardIds.SkyPirateFlagbearer_BG30_119:\r\n\t\tcase CardIds.SkyPirateFlagbearer_BG30_119_G:\r\n\t\t\treturn SkyPirateFlagbearer;\r\n\t\tcase CardIds.HummingBird_BG26_805:\r\n\t\tcase CardIds.HummingBird_BG26_805_G:\r\n\t\t\treturn HummingBird;\r\n\r\n\t\tdefault:\r\n\t\t\treturn null;\r\n\t}\r\n};\r\n\r\nconst onStartOfCombatTriggered = (iteration: number, triggeredCardId: string, playerEntity: BgsPlayerEntity) => {\r\n\t// Some procs are iso-functional, and don't update the promo portrait\r\n\tconst promoPortraits = playerEntity.trinkets.filter(\r\n\t\t(t) => t.cardId === CardIds.PromoPortrait_BG30_MagicItem_918 && t.scriptDataNum1 > 0,\r\n\t);\r\n\tif (promoPortraits.length === 0 || iteration === 0 || iteration >= promoPortraits.length) {\r\n\t\treturn;\r\n\t}\r\n\r\n\tswitch (triggeredCardId) {\r\n\t\tcase CardIds.StolenGold:\r\n\t\tcase CardIds.HolyMallet_BG30_MagicItem_902:\r\n\t\tcase CardIds.EmeraldDreamcatcher_BG30_MagicItem_542:\r\n\t\tcase CardIds.EternalPortrait_BG30_MagicItem_301:\r\n\t\tcase CardIds.BronzeTimepiece_BG30_MagicItem_995:\r\n\t\tcase CardIds.SwattingInsects:\r\n\t\tcase CardIds.RebornRites:\r\n\t\t\treturn;\r\n\t}\r\n\r\n\tconst promoPortrait = promoPortraits[iteration - 1];\r\n\tpromoPortrait.scriptDataNum1--;\r\n};\r\n\r\nconst getPromoPortraitCount = (playerEntity: BgsPlayerEntity) => {\r\n\treturn playerEntity.trinkets.filter(\r\n\t\t(t) => t.cardId === CardIds.PromoPortrait_BG30_MagicItem_918 && t.scriptDataNum1 > 0,\r\n\t).length;\r\n};\r\n"]}
|
|
1
|
+
{"version":3,"file":"soc-action-processor.js","sourceRoot":"","sources":["../../../src/simulation/start-of-combat/soc-action-processor.ts"],"names":[],"mappings":";;;AAKA,4EAAwE;AACxE,sFAAiF;AACjF,+EAA0E;AAC1E,iFAA6E;AAC7E,qEAAiE;AACjE,mEAA+D;AAC/D,mEAA+D;AAC/D,iEAA6D;AAC7D,qEAAiE;AACjE,6EAAwE;AACxE,mFAA+E;AAC/E,qFAAgF;AAChF,iFAA6E;AAC7E,yFAAqF;AACrF,+EAA2E;AAC3E,2FAAuF;AACvF,qFAAiF;AACjF,2EAAuE;AACvE,mFAA+E;AAC/E,uEAAoE;AACpE,mFAA+E;AAC/E,yEAAqE;AACrE,2EAAuE;AACvE,+EAA2E;AAC3E,yEAAqE;AACrE,2EAAuE;AACvE,mFAA+E;AAC/E,2DAAwD;AACxD,+EAA2E;AAC3E,2EAAuE;AACvE,mFAA+E;AAC/E,mFAA+E;AAC/E,uEAAmE;AACnE,2FAAuF;AACvF,yEAAqE;AACrE,uEAAmE;AACnE,iFAA6E;AAC7E,uFAAiF;AACjF,mFAA8E;AAC9E,iEAA6D;AAC7D,2EAAuE;AACvE,yDAAsD;AACtD,yFAAoF;AACpF,uEAAoE;AACpE,uEAAmE;AACnE,qFAAgF;AAChF,2FAAsF;AACtF,qEAAkE;AAClE,yFAAoF;AACpF,uEAAmE;AACnE,6FAAwF;AACxF,2EAAuE;AACvE,0EAAsE;AACtE,0EAAsE;AACtE,oFAAgF;AAChF,gFAA4E;AAC5E,wFAAoF;AACpF,gFAA4E;AAC5E,0EAAsE;AACtE,oEAAgE;AAChE,wEAAoE;AAC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;QACpD,0BAAgD;QAChD,0BAAgD;QAChD,2BAA6B;QAC7B,2BAAyB;QACzB;YACC,OAAO;KACR;IAED,MAAM,aAAa,GAAG,cAAc,CAAC,SAAS,GAAG,CAAC,CAAC,CAAC;IACpD,aAAa,CAAC,cAAc,EAAE,CAAC;AAChC,CAAC,CAAC;AAEF,MAAM,qBAAqB,GAAG,CAAC,YAA6B,EAAE,EAAE;IAC/D,OAAO,YAAY,CAAC,QAAQ,CAAC,MAAM,CAClC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,yBAA6C,IAAI,CAAC,CAAC,cAAc,GAAG,CAAC,CACpF,CAAC,MAAM,CAAC;AACV,CAAC,CAAC","sourcesContent":["import { CardIds } from '@firestone-hs/reference-data';\r\nimport { BgsPlayerEntity, BoardTrinket } from '../../bgs-player-entity';\r\nimport { BoardEntity } from '../../board-entity';\r\nimport { BoardSecret } from '../../board-secret';\r\nimport { StartOfCombatCard, StartOfCombatTiming } from '../../cards/card.interface';\r\nimport { AnomalousTwin } from '../../cards/impl/anomaly/anomalous-twin';\r\nimport { BlessedOrBlighted } from '../../cards/impl/anomaly/blessed-or-blighted';\r\nimport { BoonOfBeetles } from '../../cards/impl/bg-spell/boon-of-beetles';\r\nimport { ToxicTumbleweed } from '../../cards/impl/bg-spell/toxic-tumbleweed';\r\nimport { UpperHand } from '../../cards/impl/bg-spell/upper-hand';\r\nimport { AimHigh } from '../../cards/impl/hero-power/aim-high';\r\nimport { AimLeft } from '../../cards/impl/hero-power/aim-left';\r\nimport { AimLow } from '../../cards/impl/hero-power/aim-low';\r\nimport { AimRight } from '../../cards/impl/hero-power/aim-right';\r\nimport { AllWillBurn } from '../../cards/impl/hero-power/all-will-burn';\r\nimport { EarthInvocation } from '../../cards/impl/hero-power/earth-invocation';\r\nimport { EmbraceYourRage } from '../../cards/impl/hero-power/embrace-your-rage';\r\nimport { FireInvocation } from '../../cards/impl/hero-power/fire-invocation';\r\nimport { FragrantPhylactery } from '../../cards/impl/hero-power/fragrant-phylactery';\r\nimport { GloriousGloop } from '../../cards/impl/hero-power/glorious-gloop';\r\nimport { LightningInvocation } from '../../cards/impl/hero-power/lightning-invocation';\r\nimport { RapidReanimation } from '../../cards/impl/hero-power/rapid-reanimation';\r\nimport { RebornRites } from '../../cards/impl/hero-power/reborn-rites';\r\nimport { SwattingInsects } from '../../cards/impl/hero-power/swatting-insects';\r\nimport { Tentacular } from '../../cards/impl/hero-power/tentacular';\r\nimport { WaterInvocation } from '../../cards/impl/hero-power/water-invocation';\r\nimport { WaxWarband } from '../../cards/impl/hero-power/wax-warband';\r\nimport { AmberGuardian } from '../../cards/impl/minion/amber-guardian';\r\nimport { AudaciousAnchor } from '../../cards/impl/minion/audacious-anchor';\r\nimport { CarbonicCopy } from '../../cards/impl/minion/carbonic-copy';\r\nimport { ChoralMrrrglr } from '../../cards/impl/minion/choral-mrrrglr';\r\nimport { CorruptedMyrmidon } from '../../cards/impl/minion/corrupted-myrmidon';\r\nimport { Crabby } from '../../cards/impl/minion/crabby';\r\nimport { DiremuckForager } from '../../cards/impl/minion/diremuck-forager';\r\nimport { ElderTaggawag } from '../../cards/impl/minion/elder-taggawag';\r\nimport { HawkstriderHerald } from '../../cards/impl/minion/hawkstrider-herald';\r\nimport { HoardingHatespawn } from '../../cards/impl/minion/hoarding-hatespawn';\r\nimport { HummingBird } from '../../cards/impl/minion/humming-bird';\r\nimport { InterrogatorWhitemane } from '../../cards/impl/minion/interrogator-whitemane';\r\nimport { IrateRooster } from '../../cards/impl/minion/irate-rooster';\r\nimport { MantidQueen } from '../../cards/impl/minion/mantid-queen';\r\nimport { MisfitDragonling } from '../../cards/impl/minion/misfit-dragonling';\r\nimport { PilotedWhirlOTron } from '../../cards/impl/minion/piloted-whirl-o-tron';\r\nimport { PrizedPromoDrake } from '../../cards/impl/minion/prized-promo-drake';\r\nimport { RedWhelp } from '../../cards/impl/minion/red-whelp';\r\nimport { SanctumRester } from '../../cards/impl/minion/sanctum-rester';\r\nimport { Sandy } from '../../cards/impl/minion/sandy';\r\nimport { SkyPirateFlagbearer } from '../../cards/impl/minion/sky-pirate-flagbearer';\r\nimport { Soulsplitter } from '../../cards/impl/minion/soulsplitter';\r\nimport { SunScreener } from '../../cards/impl/minion/sun-screener';\r\nimport { TheUninvitedGuest } from '../../cards/impl/minion/the-uninvited-guest';\r\nimport { ThousandthPaperDrake } from '../../cards/impl/minion/thousandth-paper-drake';\r\nimport { Vaelastrasz } from '../../cards/impl/minion/vaelastrasz';\r\nimport { YulonFortuneGranter } from '../../cards/impl/minion/yulon-fortune-granter';\r\nimport { EvilTwin } from '../../cards/impl/quest-reward/evil-twin';\r\nimport { StaffOfOrigination } from '../../cards/impl/quest-reward/staff-of-origination';\r\nimport { StolenGold } from '../../cards/impl/quest-reward/stolen-gold';\r\nimport { FleetingVigor } from '../../cards/impl/spell/fleeting-vigor';\r\nimport { ArtisanalUrn } from '../../cards/impl/trinket/artisanal-urn';\r\nimport { AutomatonPortrait } from '../../cards/impl/trinket/automaton-portrait';\r\nimport { BronzeTimepiece } from '../../cards/impl/trinket/bronze-timepiece';\r\nimport { EmeraldDreamcatcher } from '../../cards/impl/trinket/emerald-dreamcatcher';\r\nimport { EternalPortrait } from '../../cards/impl/trinket/eternal-portrait';\r\nimport { FishySticker } from '../../cards/impl/trinket/fishy-sticker';\r\nimport { HoggyBank } from '../../cards/impl/trinket/hoggy-bank';\r\nimport { HollyMallet } from '../../cards/impl/trinket/holly-mallet';\r\nimport { IronforgeAnvil } from '../../cards/impl/trinket/ironforge-anvil';\r\nimport { JarredFrostling } from '../../cards/impl/trinket/jarred-frostling';\r\nimport { KarazhanChessSet } from '../../cards/impl/trinket/karazhan-chess-set';\r\nimport { RivendarePortrait } from '../../cards/impl/trinket/rivendare-portrait';\r\nimport { RustyTrident } from '../../cards/impl/trinket/rusty-trident';\r\nimport { ShipInABottle } from '../../cards/impl/trinket/ship-in-a-bottle';\r\nimport { SummoningSphere } from '../../cards/impl/trinket/summoning-sphere';\r\nimport { TinyfinOnesie } from '../../cards/impl/trinket/tinyfin-onesie';\r\nimport { TrainingCertificate } from '../../cards/impl/trinket/training-certificate';\r\nimport { ValorousMedallion } from '../../cards/impl/trinket/valorous-medaillion';\r\nimport { processMinionDeath } from '../attack';\r\nimport { SoCInput } from './start-of-combat-input';\r\n\r\nexport const performStartOfCombatAction = (\r\n\tcardId: string,\r\n\tentity: BoardEntity | BoardTrinket | BgsPlayerEntity | BoardSecret,\r\n\tinput: SoCInput,\r\n\tprocessDeaths: boolean,\r\n\ttiming?: StartOfCombatTiming,\r\n): boolean => {\r\n\tlet hasTriggered:\r\n\t\t| boolean\r\n\t\t| {\r\n\t\t\t\thasTriggered: boolean;\r\n\t\t\t\tshouldRecomputeCurrentAttacker: boolean;\r\n\t\t } = false;\r\n\tconst promoPortraitCount = getPromoPortraitCount(input.playerEntity);\r\n\tfor (let i = promoPortraitCount; i >= 0; i--) {\r\n\t\tconst card = getStartOfCombatAction(cardId);\r\n\t\tif (!!timing && card?.startOfCombatTiming !== timing) {\r\n\t\t\treturn false;\r\n\t\t}\r\n\r\n\t\tconst action = card?.startOfCombat;\r\n\t\tif (!!action) {\r\n\t\t\thasTriggered = action(entity, input);\r\n\t\t\t// Always proc it (for promo portrait), and use the hasTriggered for finer control\r\n\t\t\tonStartOfCombatTriggered(i, cardId, input.playerEntity);\r\n\t\t\tif (!!hasTriggered) {\r\n\t\t\t\tif (processDeaths) {\r\n\t\t\t\t\tprocessMinionDeath(\r\n\t\t\t\t\t\tinput.playerBoard,\r\n\t\t\t\t\t\tinput.playerEntity,\r\n\t\t\t\t\t\tinput.opponentBoard,\r\n\t\t\t\t\t\tinput.opponentEntity,\r\n\t\t\t\t\t\tinput.gameState,\r\n\t\t\t\t\t);\r\n\t\t\t\t}\r\n\t\t\t\tif (typeof hasTriggered !== 'boolean' && hasTriggered.shouldRecomputeCurrentAttacker) {\r\n\t\t\t\t\tinput.currentAttacker =\r\n\t\t\t\t\t\tinput.playerBoard.length > input.opponentBoard.length\r\n\t\t\t\t\t\t\t? input.playerIsFriendly\r\n\t\t\t\t\t\t\t\t? 0\r\n\t\t\t\t\t\t\t\t: 1\r\n\t\t\t\t\t\t\t: input.opponentBoard.length > input.playerBoard.length\r\n\t\t\t\t\t\t\t? input.playerIsFriendly\r\n\t\t\t\t\t\t\t\t? 1\r\n\t\t\t\t\t\t\t\t: 0\r\n\t\t\t\t\t\t\t: Math.round(Math.random());\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn !!hasTriggered;\r\n};\r\n\r\n// TODO: load all cards on start, then do some programmatic mapping\r\nconst getStartOfCombatAction = (cardId: string): StartOfCombatCard => {\r\n\tswitch (cardId) {\r\n\t\t// Quest rewards\r\n\t\tcase CardIds.EvilTwin:\r\n\t\t\treturn EvilTwin;\r\n\t\tcase CardIds.StaffOfOrigination_BG24_Reward_312:\r\n\t\t\treturn StaffOfOrigination;\r\n\t\tcase CardIds.StolenGold:\r\n\t\t\treturn StolenGold;\r\n\r\n\t\t// Trinkets\r\n\t\tcase CardIds.HolyMallet_BG30_MagicItem_902:\r\n\t\t\treturn HollyMallet;\r\n\t\tcase CardIds.TrainingCertificate_BG30_MagicItem_962:\r\n\t\t\treturn TrainingCertificate;\r\n\t\tcase CardIds.ValorousMedallion_BG30_MagicItem_970:\r\n\t\tcase CardIds.ValorousMedallion_ValorousMedallionToken_BG30_MagicItem_970t:\r\n\t\t\treturn ValorousMedallion;\r\n\t\tcase CardIds.EmeraldDreamcatcher_BG30_MagicItem_542:\r\n\t\t\treturn EmeraldDreamcatcher;\r\n\t\tcase CardIds.JarredFrostling_BG30_MagicItem_952:\r\n\t\t\treturn JarredFrostling;\r\n\t\tcase CardIds.RustyTrident_BG30_MagicItem_917:\r\n\t\t\treturn RustyTrident;\r\n\t\tcase CardIds.HoggyBank_BG30_MagicItem_411:\r\n\t\t\treturn HoggyBank;\r\n\t\tcase CardIds.AutomatonPortrait_BG30_MagicItem_303:\r\n\t\t\treturn AutomatonPortrait;\r\n\t\tcase CardIds.ShipInABottle_BG30_MagicItem_407:\r\n\t\t\treturn ShipInABottle;\r\n\t\tcase CardIds.EternalPortrait_BG30_MagicItem_301:\r\n\t\t\treturn EternalPortrait;\r\n\t\tcase CardIds.ArtisanalUrn_BG30_MagicItem_989:\r\n\t\tcase CardIds.ArtisanalUrn_ArtisanalUrnToken_BG30_MagicItem_989t:\r\n\t\t\treturn ArtisanalUrn;\r\n\t\tcase CardIds.RivendarePortrait_BG30_MagicItem_310:\r\n\t\t\treturn RivendarePortrait;\r\n\t\tcase CardIds.TinyfinOnesie_BG30_MagicItem_441:\r\n\t\t\treturn TinyfinOnesie;\r\n\t\tcase CardIds.BronzeTimepiece_BG30_MagicItem_995:\r\n\t\t\treturn BronzeTimepiece;\r\n\t\tcase CardIds.IronforgeAnvil_BG30_MagicItem_403:\r\n\t\t\treturn IronforgeAnvil;\r\n\t\tcase CardIds.KarazhanChessSet_BG30_MagicItem_972:\r\n\t\t\treturn KarazhanChessSet;\r\n\t\tcase CardIds.FishySticker_BG30_MagicItem_821:\r\n\t\tcase CardIds.FishySticker_FishyStickerToken_BG30_MagicItem_821t2:\r\n\t\t\treturn FishySticker;\r\n\t\tcase CardIds.SummoningSphere_BGDUO_MagicItem_003:\r\n\t\t\treturn SummoningSphere;\r\n\r\n\t\t// Hero powers\r\n\t\tcase CardIds.SwattingInsects:\r\n\t\t\treturn SwattingInsects;\r\n\t\tcase CardIds.EarthInvocationToken:\r\n\t\t\treturn EarthInvocation;\r\n\t\tcase CardIds.WaterInvocationToken:\r\n\t\t\treturn WaterInvocation;\r\n\t\tcase CardIds.FireInvocationToken:\r\n\t\t\treturn FireInvocation;\r\n\t\tcase CardIds.LightningInvocationToken:\r\n\t\t\treturn LightningInvocation;\r\n\t\tcase CardIds.AllWillBurn:\r\n\t\t\treturn AllWillBurn;\r\n\t\tcase CardIds.TamsinRoame_FragrantPhylactery:\r\n\t\t\treturn FragrantPhylactery;\r\n\t\tcase CardIds.EmbraceYourRage:\r\n\t\t\treturn EmbraceYourRage;\r\n\t\tcase CardIds.Ozumat_Tentacular:\r\n\t\t\treturn Tentacular;\r\n\t\tcase CardIds.RebornRites:\r\n\t\t\treturn RebornRites;\r\n\t\tcase CardIds.TeronGorefiend_RapidReanimation:\r\n\t\t\treturn RapidReanimation;\r\n\t\tcase CardIds.WaxWarband:\r\n\t\t\treturn WaxWarband;\r\n\t\tcase CardIds.FlobbidinousFloop_GloriousGloop_BGDUO_HERO_101p:\r\n\t\t\treturn GloriousGloop;\r\n\t\tcase CardIds.AimLeftToken:\r\n\t\t\treturn AimLeft;\r\n\t\tcase CardIds.AimRightToken:\r\n\t\t\treturn AimRight;\r\n\t\tcase CardIds.AimLowToken:\r\n\t\t\treturn AimLow;\r\n\t\tcase CardIds.AimHighToken:\r\n\t\t\treturn AimHigh;\r\n\r\n\t\t// Anomalies\r\n\t\tcase CardIds.BlessedOrBlighted_BG27_Anomaly_726:\r\n\t\t\treturn BlessedOrBlighted;\r\n\t\tcase CardIds.AnomalousTwin_BG27_Anomaly_560:\r\n\t\t\treturn AnomalousTwin;\r\n\t\tcase CardIds.BoonOfBeetles_BG28_603:\r\n\t\t\treturn BoonOfBeetles;\r\n\r\n\t\t// Spells\r\n\t\tcase CardIds.ToxicTumbleweed_BG28_641:\r\n\t\t\treturn ToxicTumbleweed;\r\n\t\tcase CardIds.UpperHand_BG28_573:\r\n\t\t\treturn UpperHand;\r\n\t\tcase CardIds.FleetingVigor_BG28_519:\r\n\t\t\treturn FleetingVigor;\r\n\r\n\t\t// Minions\r\n\t\tcase CardIds.RedWhelp_BGS_019:\r\n\t\tcase CardIds.RedWhelp_TB_BaconUps_102:\r\n\t\t\treturn RedWhelp;\r\n\t\tcase CardIds.PrizedPromoDrake_BG21_014:\r\n\t\tcase CardIds.PrizedPromoDrake_BG21_014_G:\r\n\t\t\treturn PrizedPromoDrake;\r\n\t\tcase CardIds.ChoralMrrrglr_BG26_354:\r\n\t\tcase CardIds.ChoralMrrrglr_BG26_354_G:\r\n\t\t\treturn ChoralMrrrglr;\r\n\t\tcase CardIds.AmberGuardian_BG24_500:\r\n\t\tcase CardIds.AmberGuardian_BG24_500_G:\r\n\t\t\treturn AmberGuardian;\r\n\t\tcase CardIds.SanctumRester_BG26_356:\r\n\t\tcase CardIds.SanctumRester_BG26_356_G:\r\n\t\t\treturn SanctumRester;\r\n\t\tcase CardIds.Soulsplitter_BG25_023:\r\n\t\tcase CardIds.Soulsplitter_BG25_023_G:\r\n\t\t\treturn Soulsplitter;\r\n\t\tcase CardIds.Crabby_BG22_HERO_000_Buddy:\r\n\t\tcase CardIds.Crabby_BG22_HERO_000_Buddy_G:\r\n\t\t\treturn Crabby;\r\n\t\tcase CardIds.CorruptedMyrmidon_BG23_012:\r\n\t\tcase CardIds.CorruptedMyrmidon_BG23_012_G:\r\n\t\t\treturn CorruptedMyrmidon;\r\n\t\tcase CardIds.InterrogatorWhitemane_BG24_704:\r\n\t\tcase CardIds.InterrogatorWhitemane_BG24_704_G:\r\n\t\t\treturn InterrogatorWhitemane;\r\n\t\tcase CardIds.MantidQueen_BG22_402:\r\n\t\tcase CardIds.MantidQueen_BG22_402_G:\r\n\t\t\treturn MantidQueen;\r\n\t\tcase CardIds.CarbonicCopy_BG27_503:\r\n\t\tcase CardIds.CarbonicCopy_BG27_503_G:\r\n\t\t\treturn CarbonicCopy;\r\n\t\tcase CardIds.DiremuckForager_BG27_556:\r\n\t\tcase CardIds.DiremuckForager_BG27_556_G:\r\n\t\t\treturn DiremuckForager;\r\n\t\tcase CardIds.HawkstriderHerald_BG27_079:\r\n\t\tcase CardIds.HawkstriderHerald_BG27_079_G:\r\n\t\t\treturn HawkstriderHerald;\r\n\t\tcase CardIds.AudaciousAnchor_BG28_904:\r\n\t\tcase CardIds.AudaciousAnchor_BG28_904_G:\r\n\t\t\treturn AudaciousAnchor;\r\n\t\tcase CardIds.PilotedWhirlOTron_BG21_HERO_030_Buddy:\r\n\t\tcase CardIds.PilotedWhirlOTron_BG21_HERO_030_Buddy_G:\r\n\t\t\treturn PilotedWhirlOTron;\r\n\t\tcase CardIds.IrateRooster_BG29_990:\r\n\t\tcase CardIds.IrateRooster_BG29_990_G:\r\n\t\t\treturn IrateRooster;\r\n\t\tcase CardIds.MisfitDragonling_BG29_814:\r\n\t\tcase CardIds.MisfitDragonling_BG29_814_G:\r\n\t\t\treturn MisfitDragonling;\r\n\t\tcase CardIds.ThousandthPaperDrake_BG29_810:\r\n\t\tcase CardIds.ThousandthPaperDrake_BG29_810_G:\r\n\t\t\treturn ThousandthPaperDrake;\r\n\t\tcase CardIds.YulonFortuneGranter_BG29_811:\r\n\t\tcase CardIds.YulonFortuneGranter_BG29_811_G:\r\n\t\t\treturn YulonFortuneGranter;\r\n\t\tcase CardIds.HoardingHatespawn_BG29_872:\r\n\t\tcase CardIds.HoardingHatespawn_BG29_872_G:\r\n\t\t\treturn HoardingHatespawn;\r\n\t\tcase CardIds.TheUninvitedGuest_BG29_875:\r\n\t\tcase CardIds.TheUninvitedGuest_BG29_875_G:\r\n\t\t\treturn TheUninvitedGuest;\r\n\t\tcase CardIds.Sandy_BGDUO_125:\r\n\t\tcase CardIds.Sandy_BGDUO_125_G:\r\n\t\t\treturn Sandy;\r\n\t\tcase CardIds.Vaelastrasz_TB_BaconShop_HERO_56_Buddy:\r\n\t\tcase CardIds.Vaelastrasz_TB_BaconShop_HERO_56_Buddy_G:\r\n\t\t\treturn Vaelastrasz;\r\n\t\tcase CardIds.ElderTaggawag_TB_BaconShop_HERO_14_Buddy:\r\n\t\tcase CardIds.ElderTaggawag_TB_BaconShop_HERO_14_Buddy_G:\r\n\t\t\treturn ElderTaggawag;\r\n\t\tcase CardIds.SunScreener_BG30_101:\r\n\t\tcase CardIds.SunScreener_BG30_101_G:\r\n\t\t\treturn SunScreener;\r\n\t\tcase CardIds.SkyPirateFlagbearer_BG30_119:\r\n\t\tcase CardIds.SkyPirateFlagbearer_BG30_119_G:\r\n\t\t\treturn SkyPirateFlagbearer;\r\n\t\tcase CardIds.HummingBird_BG26_805:\r\n\t\tcase CardIds.HummingBird_BG26_805_G:\r\n\t\t\treturn HummingBird;\r\n\r\n\t\tdefault:\r\n\t\t\treturn null;\r\n\t}\r\n};\r\n\r\nconst onStartOfCombatTriggered = (iteration: number, triggeredCardId: string, playerEntity: BgsPlayerEntity) => {\r\n\t// Some procs are iso-functional, and don't update the promo portrait\r\n\tconst promoPortraits = playerEntity.trinkets.filter(\r\n\t\t(t) => t.cardId === CardIds.PromoPortrait_BG30_MagicItem_918 && t.scriptDataNum1 > 0,\r\n\t);\r\n\tif (promoPortraits.length === 0 || iteration === 0 || iteration > promoPortraits.length) {\r\n\t\treturn;\r\n\t}\r\n\r\n\tswitch (triggeredCardId) {\r\n\t\tcase CardIds.StolenGold:\r\n\t\tcase CardIds.HolyMallet_BG30_MagicItem_902:\r\n\t\tcase CardIds.EmeraldDreamcatcher_BG30_MagicItem_542:\r\n\t\tcase CardIds.EternalPortrait_BG30_MagicItem_301:\r\n\t\tcase CardIds.BronzeTimepiece_BG30_MagicItem_995:\r\n\t\tcase CardIds.SwattingInsects:\r\n\t\tcase CardIds.RebornRites:\r\n\t\tcase CardIds.BoonOfBeetles_BG28_603:\r\n\t\t\treturn;\r\n\t}\r\n\r\n\tconst promoPortrait = promoPortraits[iteration - 1];\r\n\tpromoPortrait.scriptDataNum1--;\r\n};\r\n\r\nconst getPromoPortraitCount = (playerEntity: BgsPlayerEntity) => {\r\n\treturn playerEntity.trinkets.filter(\r\n\t\t(t) => t.cardId === CardIds.PromoPortrait_BG30_MagicItem_918 && t.scriptDataNum1 > 0,\r\n\t).length;\r\n};\r\n"]}
|
|
@@ -32,7 +32,7 @@ const handleStartOfCombatAnomaliesForPlayer = (input) => {
|
|
|
32
32
|
return input.currentAttacker;
|
|
33
33
|
}
|
|
34
34
|
for (const anomaly of input.gameState.anomalies) {
|
|
35
|
-
(0, soc_action_processor_1.performStartOfCombatAction)(anomaly, input.playerEntity, input);
|
|
35
|
+
(0, soc_action_processor_1.performStartOfCombatAction)(anomaly, input.playerEntity, input, false);
|
|
36
36
|
}
|
|
37
37
|
return input.currentAttacker;
|
|
38
38
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"soc-anomalies.js","sourceRoot":"","sources":["../../../src/simulation/start-of-combat/soc-anomalies.ts"],"names":[],"mappings":";;;AAGA,4DAA8D;AAC9D,iEAAoE;AAG7D,MAAM,4BAA4B,GAAG,CAC3C,YAA6B,EAC7B,WAA0B,EAC1B,cAA+B,EAC/B,aAA4B,EAC5B,eAAuB,EACvB,SAAwB,EACf,EAAE;IACX,eAAe,GAAG,qCAAqC,CAAC;QACvD,YAAY,EAAE,YAAY;QAC1B,WAAW,EAAE,WAAW;QACxB,cAAc,EAAE,cAAc;QAC9B,aAAa,EAAE,aAAa;QAC5B,eAAe;QACf,SAAS;QACT,gBAAgB,EAAE,IAAI;KACtB,CAAC,CAAC;IACH,eAAe,GAAG,qCAAqC,CAAC;QACvD,YAAY,EAAE,cAAc;QAC5B,WAAW,EAAE,aAAa;QAC1B,cAAc,EAAE,YAAY;QAC5B,aAAa,EAAE,WAAW;QAC1B,eAAe;QACf,SAAS;QACT,gBAAgB,EAAE,KAAK;KACvB,CAAC,CAAC;IACH,IAAA,0CAAsB,EAAC,WAAW,EAAE,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,SAAS,CAAC,CAAC;IAC5F,OAAO,eAAe,CAAC;AACxB,CAAC,CAAC;AA5BW,QAAA,4BAA4B,gCA4BvC;AAEF,MAAM,qCAAqC,GAAG,CAAC,KAAe,EAAU,EAAE;;IACzE,IAAI,CAAC,CAAA,MAAA,KAAK,CAAC,SAAS,CAAC,SAAS,0CAAE,MAAM,CAAA,IAAI,KAAK,CAAC,YAAY,CAAC,iBAAiB,EAAE;QAC/E,OAAO,KAAK,CAAC,eAAe,CAAC;KAC7B;IAED,KAAK,MAAM,OAAO,IAAI,KAAK,CAAC,SAAS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AO,EAAE,KAAK,CAAC,YAAY,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;KACtE;IAED,OAAO,KAAK,CAAC,eAAe,CAAC;AAC9B,CAAC,CAAC","sourcesContent":["import { BgsPlayerEntity } from '../../bgs-player-entity';\r\nimport { BoardEntity } from '../../board-entity';\r\nimport { FullGameState } from '../internal-game-state';\r\nimport { handleSummonsWhenSpace } from '../summon-when-space';\r\nimport { performStartOfCombatAction } from './soc-action-processor';\r\nimport { SoCInput } from './start-of-combat-input';\r\n\r\nexport const handleStartOfCombatAnomalies = (\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\tcurrentAttacker = handleStartOfCombatAnomaliesForPlayer({\r\n\t\tplayerEntity: playerEntity,\r\n\t\tplayerBoard: playerBoard,\r\n\t\topponentEntity: opponentEntity,\r\n\t\topponentBoard: opponentBoard,\r\n\t\tcurrentAttacker,\r\n\t\tgameState,\r\n\t\tplayerIsFriendly: true,\r\n\t});\r\n\tcurrentAttacker = handleStartOfCombatAnomaliesForPlayer({\r\n\t\tplayerEntity: opponentEntity,\r\n\t\tplayerBoard: opponentBoard,\r\n\t\topponentEntity: playerEntity,\r\n\t\topponentBoard: playerBoard,\r\n\t\tcurrentAttacker,\r\n\t\tgameState,\r\n\t\tplayerIsFriendly: false,\r\n\t});\r\n\thandleSummonsWhenSpace(playerBoard, playerEntity, opponentBoard, opponentEntity, gameState);\r\n\treturn currentAttacker;\r\n};\r\n\r\nconst handleStartOfCombatAnomaliesForPlayer = (input: SoCInput): number => {\r\n\tif (!input.gameState.anomalies?.length || input.playerEntity.startOfCombatDone) {\r\n\t\treturn input.currentAttacker;\r\n\t}\r\n\r\n\tfor (const anomaly of input.gameState.anomalies) {\r\n\t\tperformStartOfCombatAction(anomaly, input.playerEntity, input, false);\r\n\t}\r\n\r\n\treturn input.currentAttacker;\r\n};\r\n"]}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getHeroPowerForHero = exports.handleStartOfCombatHeroPowers = void 0;
|
|
4
|
-
const attack_1 = require("../attack");
|
|
5
4
|
const summon_when_space_1 = require("../summon-when-space");
|
|
6
5
|
const soc_action_processor_1 = require("./soc-action-processor");
|
|
7
6
|
const handleStartOfCombatHeroPowers = (playerEntity, playerBoard, opponentEntity, opponentBoard, currentAttacker, gameState) => {
|
|
@@ -54,8 +53,7 @@ const handlePlayerStartOfCombatHeroPowers = (input) => {
|
|
|
54
53
|
return input.currentAttacker;
|
|
55
54
|
}
|
|
56
55
|
const playerHeroPowerId = input.playerEntity.heroPowerId || (0, exports.getHeroPowerForHero)(input.playerEntity.cardId);
|
|
57
|
-
(0, soc_action_processor_1.performStartOfCombatAction)(playerHeroPowerId, input.playerEntity, input, 'start-of-combat');
|
|
58
|
-
(0, attack_1.processMinionDeath)(input.playerBoard, input.playerEntity, input.opponentBoard, input.opponentEntity, input.gameState);
|
|
56
|
+
(0, soc_action_processor_1.performStartOfCombatAction)(playerHeroPowerId, input.playerEntity, input, true, 'start-of-combat');
|
|
59
57
|
return input.currentAttacker;
|
|
60
58
|
};
|
|
61
59
|
const getHeroPowerForHero = (heroCardId) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"soc-hero-power.js","sourceRoot":"","sources":["../../../src/simulation/start-of-combat/soc-hero-power.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"soc-hero-power.js","sourceRoot":"","sources":["../../../src/simulation/start-of-combat/soc-hero-power.ts"],"names":[],"mappings":";;;AAIA,4DAA8D;AAC9D,iEAAoE;AAG7D,MAAM,6BAA6B,GAAG,CAC5C,YAA6B,EAC7B,WAA0B,EAC1B,cAA+B,EAC/B,aAA4B,EAC5B,eAAuB,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,CAAC;KAC7B;IAED,MAAM,iBAAiB,GAAG,KAAK,CAAC,YAAY,CAAC,WAAW,IAAI,IAAA,2BAAmB,EAAC,KAAK,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;IAC3G,IAAA,iDAA0B,EAAC,iBAAiB,EAAE,KAAK,CAAC,YAAY,EAAE,KAAK,EAAE,IAAI,EAAE,iBAAiB,CAAC,CAAC;IAClG,OAAO,KAAK,CAAC,eAAe,CAAC;AAC9B,CAAC,CAAC;AAEK,MAAM,mBAAmB,GAAG,CAAC,UAAkB,EAAU,EAAE;IACjE,QAAQ,UAAU,EAAE;QACnB;YACC,6BAAuB;QACxB;YACC,6BAA2B;QAC5B;YACC,6BAA0B;QAC3B;YACC,6BAA2B;QAC5B;YACC,wBAA+C;KAChD;IACD,OAAO,IAAI,CAAC;AACb,CAAC,CAAC;AAdW,QAAA,mBAAmB,uBAc9B","sourcesContent":["import { CardIds } from '@firestone-hs/reference-data';\r\nimport { BgsPlayerEntity } from '../../bgs-player-entity';\r\nimport { BoardEntity } from '../../board-entity';\r\nimport { FullGameState } from '../internal-game-state';\r\nimport { handleSummonsWhenSpace } from '../summon-when-space';\r\nimport { performStartOfCombatAction } from './soc-action-processor';\r\nimport { SoCInput } from './start-of-combat-input';\r\n\r\nexport const handleStartOfCombatHeroPowers = (\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// 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 = handlePlayerStartOfCombatHeroPowers({\r\n\t\t\tplayerEntity: playerEntity,\r\n\t\t\tplayerBoard: playerBoard,\r\n\t\t\topponentEntity: opponentEntity,\r\n\t\t\topponentBoard: opponentBoard,\r\n\t\t\tcurrentAttacker,\r\n\t\t\tplayerIsFriendly: true,\r\n\t\t\tgameState,\r\n\t\t});\r\n\t\tcurrentAttacker = handlePlayerStartOfCombatHeroPowers({\r\n\t\t\tplayerEntity: opponentEntity,\r\n\t\t\tplayerBoard: opponentBoard,\r\n\t\t\topponentEntity: playerEntity,\r\n\t\t\topponentBoard: playerBoard,\r\n\t\t\tcurrentAttacker,\r\n\t\t\tplayerIsFriendly: false,\r\n\t\t\tgameState,\r\n\t\t});\r\n\t} else {\r\n\t\tcurrentAttacker = handlePlayerStartOfCombatHeroPowers({\r\n\t\t\tplayerEntity: opponentEntity,\r\n\t\t\tplayerBoard: opponentBoard,\r\n\t\t\topponentEntity: playerEntity,\r\n\t\t\topponentBoard: playerBoard,\r\n\t\t\tcurrentAttacker,\r\n\t\t\tplayerIsFriendly: false,\r\n\t\t\tgameState,\r\n\t\t});\r\n\t\tcurrentAttacker = handlePlayerStartOfCombatHeroPowers({\r\n\t\t\tplayerEntity: playerEntity,\r\n\t\t\tplayerBoard: playerBoard,\r\n\t\t\topponentEntity: opponentEntity,\r\n\t\t\topponentBoard: opponentBoard,\r\n\t\t\tcurrentAttacker,\r\n\t\t\tplayerIsFriendly: true,\r\n\t\t\tgameState,\r\n\t\t});\r\n\t}\r\n\thandleSummonsWhenSpace(playerBoard, playerEntity, opponentBoard, opponentEntity, gameState);\r\n\treturn currentAttacker;\r\n};\r\n\r\nconst handlePlayerStartOfCombatHeroPowers = (input: SoCInput): number => {\r\n\tif (input.playerEntity.startOfCombatDone || input.playerEntity.hpLeft <= 0) {\r\n\t\treturn input.currentAttacker;\r\n\t}\r\n\r\n\tconst playerHeroPowerId = input.playerEntity.heroPowerId || getHeroPowerForHero(input.playerEntity.cardId);\r\n\tperformStartOfCombatAction(playerHeroPowerId, input.playerEntity, input, true, 'start-of-combat');\r\n\treturn input.currentAttacker;\r\n};\r\n\r\nexport const getHeroPowerForHero = (heroCardId: string): string => {\r\n\tswitch (heroCardId) {\r\n\t\tcase CardIds.IllidanStormrage_TB_BaconShop_HERO_08:\r\n\t\t\treturn CardIds.Wingmen;\r\n\t\tcase CardIds.TheLichKing_TB_BaconShop_HERO_22:\r\n\t\t\treturn CardIds.RebornRites;\r\n\t\tcase CardIds.ProfessorPutricide_BG25_HERO_100:\r\n\t\t\treturn CardIds.RagePotion;\r\n\t\tcase CardIds.Deathwing_TB_BaconShop_HERO_52:\r\n\t\t\treturn CardIds.AllWillBurn;\r\n\t\tcase CardIds.TeronGorefiend_BG25_HERO_103:\r\n\t\t\treturn CardIds.TeronGorefiend_RapidReanimation;\r\n\t}\r\n\treturn null;\r\n};\r\n"]}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.performStartOfCombatMinionsForPlayer = exports.handleStartOfCombatMinions = void 0;
|
|
4
|
-
const attack_1 = require("../attack");
|
|
5
4
|
const soc_action_processor_1 = require("./soc-action-processor");
|
|
6
5
|
const handleStartOfCombatMinions = (playerEntity, playerBoard, opponentEntity, opponentBoard, currentAttacker, playerBoardBefore, opponentBoardBefore, gameState) => {
|
|
7
6
|
let attackerForStart = Math.random() < 0.5 ? 0 : 1;
|
|
@@ -60,8 +59,7 @@ const performStartOfCombatMinionsForPlayer = (minion, input) => {
|
|
|
60
59
|
if (input.playerEntity.startOfCombatDone) {
|
|
61
60
|
return false;
|
|
62
61
|
}
|
|
63
|
-
const hasProcessed = (0, soc_action_processor_1.performStartOfCombatAction)(minion.cardId, minion, input);
|
|
64
|
-
(0, attack_1.processMinionDeath)(input.playerBoard, input.playerEntity, input.opponentBoard, input.opponentEntity, input.gameState);
|
|
62
|
+
const hasProcessed = (0, soc_action_processor_1.performStartOfCombatAction)(minion.cardId, minion, input, true);
|
|
65
63
|
return hasProcessed;
|
|
66
64
|
};
|
|
67
65
|
exports.performStartOfCombatMinionsForPlayer = performStartOfCombatMinionsForPlayer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"soc-minion.js","sourceRoot":"","sources":["../../../src/simulation/start-of-combat/soc-minion.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"soc-minion.js","sourceRoot":"","sources":["../../../src/simulation/start-of-combat/soc-minion.ts"],"names":[],"mappings":";;;AAGA,iEAAoE;AAG7D,MAAM,0BAA0B,GAAG,CACzC,YAA6B,EAC7B,WAA0B,EAC1B,cAA+B,EAC/B,aAA4B,EAC5B,eAAuB,EACvB,iBAAgC,EAChC,mBAAkC,EAClC,SAAwB,EACf,EAAE;IACX,IAAI,gBAAgB,GAAG,IAAI,CAAC,MAAM,EAAE,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACnD,MAAM,eAAe,GAAG,CAAC,GAAG,WAAW,CAAC,CAAC;IACzC,MAAM,iBAAiB,GAAG,CAAC,GAAG,aAAa,CAAC,CAAC;IAE7C,OAAO,eAAe,CAAC,MAAM,GAAG,CAAC,IAAI,iBAAiB,CAAC,MAAM,GAAG,CAAC,EAAE;QAClE,IAAI,sBAAsB,GAAG,KAAK,CAAC;QACnC,IAAI,gBAAgB,KAAK,CAAC,IAAI,eAAe,CAAC,MAAM,GAAG,CAAC,EAAE;YACzD,MAAM,QAAQ,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YACjD,IAAI,QAAQ,CAAC,MAAM,IAAI,CAAC,IAAI,QAAQ,CAAC,cAAc,EAAE;gBACpD,SAAS;aACT;YACD,sBAAsB,GAAG,IAAA,4CAAoC,EAAC,QAAQ,EAAE;gBACvE,WAAW,EAAE,WAAW;gBACxB,YAAY,EAAE,YAAY;gBAC1B,aAAa,EAAE,aAAa;gBAC5B,cAAc,EAAE,cAAc;gBAC9B,iBAAiB,EAAE,iBAAiB;gBACpC,mBAAmB,EAAE,mBAAmB;gBACxC,gBAAgB,EAAE,IAAI;gBACtB,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M,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC;IACpF,OAAO,YAAY,CAAC;AACrB,CAAC,CAAC;AAPW,QAAA,oCAAoC,wCAO/C","sourcesContent":["import { BgsPlayerEntity } from '../../bgs-player-entity';\r\nimport { BoardEntity } from '../../board-entity';\r\nimport { FullGameState } from '../internal-game-state';\r\nimport { performStartOfCombatAction } from './soc-action-processor';\r\nimport { SoCInput } from './start-of-combat-input';\r\n\r\nexport const handleStartOfCombatMinions = (\r\n\tplayerEntity: BgsPlayerEntity,\r\n\tplayerBoard: BoardEntity[],\r\n\topponentEntity: BgsPlayerEntity,\r\n\topponentBoard: BoardEntity[],\r\n\tcurrentAttacker: number,\r\n\tplayerBoardBefore: BoardEntity[],\r\n\topponentBoardBefore: BoardEntity[],\r\n\tgameState: FullGameState,\r\n): number => {\r\n\tlet attackerForStart = Math.random() < 0.5 ? 0 : 1;\r\n\tconst playerAttackers = [...playerBoard];\r\n\tconst opponentAttackers = [...opponentBoard];\r\n\r\n\twhile (playerAttackers.length > 0 || opponentAttackers.length > 0) {\r\n\t\tlet shouldUpdateNextPlayer = false;\r\n\t\tif (attackerForStart === 0 && playerAttackers.length > 0) {\r\n\t\t\tconst attacker = playerAttackers.splice(0, 1)[0];\r\n\t\t\tif (attacker.health <= 0 || attacker.definitelyDead) {\r\n\t\t\t\tcontinue;\r\n\t\t\t}\r\n\t\t\tshouldUpdateNextPlayer = performStartOfCombatMinionsForPlayer(attacker, {\r\n\t\t\t\tplayerBoard: playerBoard,\r\n\t\t\t\tplayerEntity: playerEntity,\r\n\t\t\t\topponentBoard: opponentBoard,\r\n\t\t\t\topponentEntity: opponentEntity,\r\n\t\t\t\tplayerBoardBefore: playerBoardBefore,\r\n\t\t\t\topponentBoardBefore: opponentBoardBefore,\r\n\t\t\t\tplayerIsFriendly: true,\r\n\t\t\t\tcurrentAttacker: 0,\r\n\t\t\t\tgameState,\r\n\t\t\t});\r\n\t\t} else if (attackerForStart === 0 && playerAttackers.length === 0) {\r\n\t\t\tshouldUpdateNextPlayer = true;\r\n\t\t} else if (attackerForStart === 1 && opponentAttackers.length > 0) {\r\n\t\t\tconst attacker = opponentAttackers.splice(0, 1)[0];\r\n\t\t\tif (attacker.health <= 0 || attacker.definitelyDead) {\r\n\t\t\t\tcontinue;\r\n\t\t\t}\r\n\t\t\tshouldUpdateNextPlayer = performStartOfCombatMinionsForPlayer(attacker, {\r\n\t\t\t\tplayerBoard: opponentBoard,\r\n\t\t\t\tplayerEntity: opponentEntity,\r\n\t\t\t\topponentBoard: playerBoard,\r\n\t\t\t\topponentEntity: playerEntity,\r\n\t\t\t\tplayerBoardBefore: opponentBoardBefore,\r\n\t\t\t\topponentBoardBefore: playerBoardBefore,\r\n\t\t\t\tplayerIsFriendly: false,\r\n\t\t\t\tcurrentAttacker: 0,\r\n\t\t\t\tgameState,\r\n\t\t\t});\r\n\t\t} else if (attackerForStart === 1 && opponentAttackers.length === 0) {\r\n\t\t\tshouldUpdateNextPlayer = true;\r\n\t\t}\r\n\r\n\t\tif (shouldUpdateNextPlayer) {\r\n\t\t\tattackerForStart = (attackerForStart + 1) % 2;\r\n\t\t}\r\n\t}\r\n\treturn currentAttacker;\r\n};\r\n\r\n// Apparently, the board composition used for start of combat minion effects (like Red Whelp, and I assume it works the\r\n// same way for others like Prized Promo Drake or Mantid Queen) is the one that is used before Illidan's effect is handled.\r\n// Since this also runs before HP start of combat, we probably also use the state as it was before HP were triggered, like\r\n// Tamsin's Phylactery.\r\nexport const performStartOfCombatMinionsForPlayer = (minion: BoardEntity, input: SoCInput): boolean => {\r\n\tif (input.playerEntity.startOfCombatDone) {\r\n\t\treturn false;\r\n\t}\r\n\r\n\tconst hasProcessed = performStartOfCombatAction(minion.cardId, minion, input, true);\r\n\treturn hasProcessed;\r\n};\r\n"]}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.handlePreCombatHeroPowers = void 0;
|
|
4
|
-
const attack_1 = require("../attack");
|
|
5
4
|
const summon_when_space_1 = require("../summon-when-space");
|
|
6
5
|
const soc_action_processor_1 = require("./soc-action-processor");
|
|
7
6
|
const soc_hero_power_1 = require("./soc-hero-power");
|
|
@@ -65,8 +64,7 @@ const handlePreCombatHeroPowersForPlayer = (input) => {
|
|
|
65
64
|
return input.currentAttacker;
|
|
66
65
|
}
|
|
67
66
|
const playerHeroPowerId = input.playerEntity.heroPowerId || (0, soc_hero_power_1.getHeroPowerForHero)(input.playerEntity.cardId);
|
|
68
|
-
(0, soc_action_processor_1.performStartOfCombatAction)(playerHeroPowerId, input.playerEntity, input, 'pre-combat');
|
|
69
|
-
(0, attack_1.processMinionDeath)(input.playerBoard, input.playerEntity, input.opponentBoard, input.opponentEntity, input.gameState);
|
|
67
|
+
(0, soc_action_processor_1.performStartOfCombatAction)(playerHeroPowerId, input.playerEntity, input, true, 'pre-combat');
|
|
70
68
|
return input.currentAttacker;
|
|
71
69
|
};
|
|
72
70
|
//# sourceMappingURL=soc-pre-combat-hero-power.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"soc-pre-combat-hero-power.js","sourceRoot":"","sources":["../../../src/simulation/start-of-combat/soc-pre-combat-hero-power.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"soc-pre-combat-hero-power.js","sourceRoot":"","sources":["../../../src/simulation/start-of-combat/soc-pre-combat-hero-power.ts"],"names":[],"mappings":";;;AAGA,4DAA8D;AAC9D,iEAAoE;AACpE,qDAAuD;AAGhD,MAAM,yBAAyB,GAAG,CACxC,YAA6B,EAC7B,WAA0B,EAC1B,cAA+B,EAC/B,aAA4B,EAC5B,eAAuB,EACvB,SAAwB,EACf,EAAE;IACX,IAAI,IAAI,CAAC,MAAM,EAAE,GAAG,GAAG,EAAE;QACxB,eAAe,GAAG,kCAAkC,CAAC;YACpD,YAAY,EAAE,YAAY;YAC1B,WAA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CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;KAC9B;IACD,OAAO,eAAe,CAAC;AACxB,CAAC,CAAC;AA9DW,QAAA,yBAAyB,6BA8DpC;AAEF,MAAM,kCAAkC,GAAG,CAAC,KAAe,EAAU,EAAE;IACtE,IAAI,KAAK,CAAC,YAAY,CAAC,iBAAiB,IAAI,KAAK,CAAC,YAAY,CAAC,MAAM,IAAI,CAAC,EAAE;QAC3E,OAAO,KAAK,CAAC,eAAe,CAAC;KAC7B;IAED,MAAM,iBAAiB,GAAG,KAAK,CAAC,YAAY,CAAC,WAAW,IAAI,IAAA,oCAAmB,EAAC,KAAK,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;IAC3G,IAAA,iDAA0B,EAAC,iBAAiB,EAAE,KAAK,CAAC,YAAY,EAAE,KAAK,EAAE,IAAI,EAAE,YAAY,CAAC,CAAC;IAE7F,OAAO,KAAK,CAAC,eAAe,CAAC;AAC9B,CAAC,CAAC","sourcesContent":["import { BgsPlayerEntity } from '../../bgs-player-entity';\r\nimport { BoardEntity } from '../../board-entity';\r\nimport { FullGameState } from '../internal-game-state';\r\nimport { handleSummonsWhenSpace } from '../summon-when-space';\r\nimport { performStartOfCombatAction } from './soc-action-processor';\r\nimport { getHeroPowerForHero } from './soc-hero-power';\r\nimport { SoCInput } from './start-of-combat-input';\r\n\r\nexport const handlePreCombatHeroPowers = (\r\n\tplayerEntity: BgsPlayerEntity,\r\n\tplayerBoard: BoardEntity[],\r\n\topponentEntity: BgsPlayerEntity,\r\n\topponentBoard: BoardEntity[],\r\n\tcurrentAttacker: number,\r\n\tgameState: FullGameState,\r\n): number => {\r\n\tif (Math.random() < 0.5) {\r\n\t\tcurrentAttacker = handlePreCombatHeroPowersForPlayer({\r\n\t\t\tplayerEntity: playerEntity,\r\n\t\t\tplayerBoard: playerBoard,\r\n\t\t\topponentEntity: opponentEntity,\r\n\t\t\topponentBoard: opponentBoard,\r\n\t\t\tcurrentAttacker,\r\n\t\t\tplayerIsFriendly: true,\r\n\t\t\tgameState,\r\n\t\t});\r\n\t\tcurrentAttacker = handlePreCombatHeroPowersForPlayer({\r\n\t\t\tplayerEntity: opponentEntity,\r\n\t\t\tplayerBoard: opponentBoard,\r\n\t\t\topponentEntity: playerEntity,\r\n\t\t\topponentBoard: playerBoard,\r\n\t\t\tcurrentAttacker,\r\n\t\t\tplayerIsFriendly: false,\r\n\t\t\tgameState,\r\n\t\t});\r\n\t} else {\r\n\t\tcurrentAttacker = handlePreCombatHeroPowersForPlayer({\r\n\t\t\tplayerEntity: opponentEntity,\r\n\t\t\tplayerBoard: opponentBoard,\r\n\t\t\topponentEntity: playerEntity,\r\n\t\t\topponentBoard: playerBoard,\r\n\t\t\tcurrentAttacker,\r\n\t\t\tplayerIsFriendly: false,\r\n\t\t\tgameState,\r\n\t\t});\r\n\t\tcurrentAttacker = handlePreCombatHeroPowersForPlayer({\r\n\t\t\tplayerEntity: playerEntity,\r\n\t\t\tplayerBoard: playerBoard,\r\n\t\t\topponentEntity: opponentEntity,\r\n\t\t\topponentBoard: opponentBoard,\r\n\t\t\tcurrentAttacker,\r\n\t\t\tplayerIsFriendly: true,\r\n\t\t\tgameState,\r\n\t\t});\r\n\t}\r\n\tconst initialPlayerBoardSize = playerBoard.length;\r\n\tconst initialOpponentBoardSize = opponentBoard.length;\r\n\t// Ozumat's Tentaclecan cause the first player to be recomputed\r\n\t// https://replays.firestoneapp.com/?reviewId=f15c90de-8b3c-4017-960d-365fe09eb7ab&turn=5&action=1\r\n\thandleSummonsWhenSpace(playerBoard, playerEntity, opponentBoard, opponentEntity, gameState);\r\n\r\n\tif (playerBoard.length !== initialPlayerBoardSize || opponentBoard.length !== initialOpponentBoardSize) {\r\n\t\tcurrentAttacker =\r\n\t\t\tplayerBoard.length > opponentBoard.length\r\n\t\t\t\t? 0\r\n\t\t\t\t: opponentBoard.length > playerBoard.length\r\n\t\t\t\t? 1\r\n\t\t\t\t: Math.round(Math.random());\r\n\t}\r\n\treturn currentAttacker;\r\n};\r\n\r\nconst handlePreCombatHeroPowersForPlayer = (input: SoCInput): number => {\r\n\tif (input.playerEntity.startOfCombatDone || input.playerEntity.hpLeft <= 0) {\r\n\t\treturn input.currentAttacker;\r\n\t}\r\n\r\n\tconst playerHeroPowerId = input.playerEntity.heroPowerId || getHeroPowerForHero(input.playerEntity.cardId);\r\n\tperformStartOfCombatAction(playerHeroPowerId, input.playerEntity, input, true, 'pre-combat');\r\n\r\n\treturn input.currentAttacker;\r\n};\r\n"]}
|
|
@@ -53,7 +53,7 @@ const handleStartOfCombatQuestRewardsForPlayer = (input) => {
|
|
|
53
53
|
return input.currentAttacker;
|
|
54
54
|
}
|
|
55
55
|
for (const reward of input.playerEntity.questRewards) {
|
|
56
|
-
(0, soc_action_processor_1.performStartOfCombatAction)(reward, input.playerEntity, input);
|
|
56
|
+
(0, soc_action_processor_1.performStartOfCombatAction)(reward, input.playerEntity, input, false);
|
|
57
57
|
}
|
|
58
58
|
return input.currentAttacker;
|
|
59
59
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"soc-quest-reward.js","sourceRoot":"","sources":["../../../src/simulation/start-of-combat/soc-quest-reward.ts"],"names":[],"mappings":";;;AAGA,4DAA8D;AAC9D,iEAAoE;AAG7D,MAAM,+BAA+B,GAAG,CAC9C,YAA6B,EAC7B,WAA0B,EAC1B,cAA+B,EAC/B,aAA4B,EAC5B,eAAuB,EACvB,SAAwB,EACf,EAAE;IACX,IAAI,IAAI,CAAC,MAAM,EAAE,GAAG,GAAG,EAAE;QACxB,eAAe,GAAG,wCAAwC,CAAC;YAC1D,YAAY,EAAE,YAAY;YAC1B,WAAW,EAAE,WAAW;YACxB,cAAc,EAAE,cAAc;YAC9B,aAAa,EAAE,aAAa;YAC5B,eAAe;YACf,SAAS;YACT,gBAAgB,EAAE,IAAI;SACtB,CAAC,CAAC;QACH,eAAe,GAAG,wCAAwC,CAAC;YAC1D,YAAY,EAAE,cAAc;YAC5B,WAAW,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I,KAAK,CAAC,YAAY,CAAC,YAAY,EAAE;QACrD,IAAA,iDAA0B,EAAC,MAAM,EAAE,KAAK,CAAC,YAAY,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;KACrE;IAED,OAAO,KAAK,CAAC,eAAe,CAAC;AAC9B,CAAC,CAAC","sourcesContent":["import { BgsPlayerEntity } from '../../bgs-player-entity';\r\nimport { BoardEntity } from '../../board-entity';\r\nimport { FullGameState } from '../internal-game-state';\r\nimport { handleSummonsWhenSpace } from '../summon-when-space';\r\nimport { performStartOfCombatAction } from './soc-action-processor';\r\nimport { SoCInput } from './start-of-combat-input';\r\n\r\nexport const handleStartOfCombatQuestRewards = (\r\n\tplayerEntity: BgsPlayerEntity,\r\n\tplayerBoard: BoardEntity[],\r\n\topponentEntity: BgsPlayerEntity,\r\n\topponentBoard: BoardEntity[],\r\n\tcurrentAttacker: number,\r\n\tgameState: FullGameState,\r\n): number => {\r\n\tif (Math.random() < 0.5) {\r\n\t\tcurrentAttacker = handleStartOfCombatQuestRewardsForPlayer({\r\n\t\t\tplayerEntity: playerEntity,\r\n\t\t\tplayerBoard: playerBoard,\r\n\t\t\topponentEntity: opponentEntity,\r\n\t\t\topponentBoard: opponentBoard,\r\n\t\t\tcurrentAttacker,\r\n\t\t\tgameState,\r\n\t\t\tplayerIsFriendly: true,\r\n\t\t});\r\n\t\tcurrentAttacker = handleStartOfCombatQuestRewardsForPlayer({\r\n\t\t\tplayerEntity: opponentEntity,\r\n\t\t\tplayerBoard: opponentBoard,\r\n\t\t\topponentEntity: playerEntity,\r\n\t\t\topponentBoard: playerBoard,\r\n\t\t\tcurrentAttacker,\r\n\t\t\tgameState,\r\n\t\t\tplayerIsFriendly: false,\r\n\t\t});\r\n\t} else {\r\n\t\tcurrentAttacker = handleStartOfCombatQuestRewardsForPlayer({\r\n\t\t\tplayerEntity: opponentEntity,\r\n\t\t\tplayerBoard: opponentBoard,\r\n\t\t\topponentEntity: playerEntity,\r\n\t\t\topponentBoard: playerBoard,\r\n\t\t\tcurrentAttacker,\r\n\t\t\tgameState,\r\n\t\t\tplayerIsFriendly: false,\r\n\t\t});\r\n\t\tcurrentAttacker = handleStartOfCombatQuestRewardsForPlayer({\r\n\t\t\tplayerEntity: playerEntity,\r\n\t\t\tplayerBoard: playerBoard,\r\n\t\t\topponentEntity: opponentEntity,\r\n\t\t\topponentBoard: opponentBoard,\r\n\t\t\tcurrentAttacker,\r\n\t\t\tgameState,\r\n\t\t\tplayerIsFriendly: true,\r\n\t\t});\r\n\t}\r\n\r\n\thandleSummonsWhenSpace(playerBoard, playerEntity, opponentBoard, opponentEntity, gameState);\r\n\treturn currentAttacker;\r\n};\r\n\r\nconst handleStartOfCombatQuestRewardsForPlayer = (input: SoCInput): number => {\r\n\tif (input.playerEntity.startOfCombatDone) {\r\n\t\treturn input.currentAttacker;\r\n\t}\r\n\r\n\tfor (const reward of input.playerEntity.questRewards) {\r\n\t\tperformStartOfCombatAction(reward, input.playerEntity, input, false);\r\n\t}\r\n\r\n\treturn input.currentAttacker;\r\n};\r\n"]}
|