@firestone-hs/simulate-bgs-battle 1.1.639 → 1.1.641
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/board-entity.d.ts +1 -0
- package/dist/board-entity.js.map +1 -1
- package/dist/cards/impl/_card-mappings.js +2 -0
- package/dist/cards/impl/_card-mappings.js.map +1 -1
- package/dist/cards/impl/hero-power/fragrant-phylactery-enchantment.js +2 -2
- package/dist/cards/impl/hero-power/fragrant-phylactery-enchantment.js.map +1 -1
- package/dist/cards/impl/hero-power/fragrant-phylactery.js +1 -1
- package/dist/cards/impl/hero-power/fragrant-phylactery.js.map +1 -1
- package/dist/cards/impl/hero-power/tentacular.js +1 -1
- package/dist/cards/impl/hero-power/tentacular.js.map +1 -1
- package/dist/cards/impl/minion/baby-yshaarj.d.ts +2 -0
- package/dist/cards/impl/minion/baby-yshaarj.js +17 -0
- package/dist/cards/impl/minion/baby-yshaarj.js.map +1 -0
- package/dist/cards/impl/minion/bile-spitter.js +1 -0
- package/dist/cards/impl/minion/bile-spitter.js.map +1 -1
- package/dist/cards/impl/minion/friendly-bouncer.js +11 -9
- package/dist/cards/impl/minion/friendly-bouncer.js.map +1 -1
- package/dist/cards/impl/minion/goldrinn-the-great-wolf.js +1 -1
- package/dist/cards/impl/minion/goldrinn-the-great-wolf.js.map +1 -1
- package/dist/cards/impl/minion/kalecgos-arcane-aspect.js +1 -1
- package/dist/cards/impl/minion/kalecgos-arcane-aspect.js.map +1 -1
- package/dist/cards/impl/minion/oranomonos-the-wilted.js +3 -2
- package/dist/cards/impl/minion/oranomonos-the-wilted.js.map +1 -1
- package/dist/cards/impl/minion/pilot-the-shredder.js +2 -0
- package/dist/cards/impl/minion/pilot-the-shredder.js.map +1 -1
- package/dist/cards/impl/minion/primeval-monstrosity.js +1 -1
- package/dist/cards/impl/minion/primeval-monstrosity.js.map +1 -1
- package/dist/cards/impl/minion/stoneshell-guardian.js +9 -15
- package/dist/cards/impl/minion/stoneshell-guardian.js.map +1 -1
- package/dist/cards/impl/minion/transmuted-bramblewitch.js.map +1 -1
- package/dist/cards/impl/minion/wrathscale-rogue.js +1 -1
- package/dist/cards/impl/minion/wrathscale-rogue.js.map +1 -1
- package/dist/simulation/death-effects.js +3 -1
- package/dist/simulation/death-effects.js.map +1 -1
- package/dist/simulation/deathrattle-effects.js +5 -1
- package/dist/simulation/deathrattle-effects.js.map +1 -1
- package/dist/simulation/deathrattle-orchestration.js +1 -0
- package/dist/simulation/deathrattle-orchestration.js.map +1 -1
- package/dist/simulation/on-attack.js +1 -0
- package/dist/simulation/on-attack.js.map +1 -1
- package/dist/simulation/on-being-attacked.js +2 -2
- package/dist/simulation/on-being-attacked.js.map +1 -1
- package/dist/simulation/start-of-combat/soc-anomalies.js +9 -1
- package/dist/simulation/start-of-combat/soc-anomalies.js.map +1 -1
- package/dist/simulation/start-of-combat/soc-illidan-hero-power.js +9 -1
- package/dist/simulation/start-of-combat/soc-illidan-hero-power.js.map +1 -1
- package/dist/simulation/start-of-combat/soc-minion.js +9 -1
- package/dist/simulation/start-of-combat/soc-minion.js.map +1 -1
- package/dist/simulation/start-of-combat/soc-quest-reward.js +9 -1
- package/dist/simulation/start-of-combat/soc-quest-reward.js.map +1 -1
- package/dist/simulation/start-of-combat/soc-secret.js +9 -1
- package/dist/simulation/start-of-combat/soc-secret.js.map +1 -1
- package/dist/simulation/start-of-combat/soc-trinket.js +9 -1
- package/dist/simulation/start-of-combat/soc-trinket.js.map +1 -1
- package/dist/simulation/stats.js +3 -1
- package/dist/simulation/stats.js.map +1 -1
- package/dist/simulation/summon-when-space.js +2 -0
- package/dist/simulation/summon-when-space.js.map +1 -1
- package/dist/utils.js +9 -3
- package/dist/utils.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"soc-minion.js","sourceRoot":"","sources":["../../../src/simulation/start-of-combat/soc-minion.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":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a/C","sourcesContent":["import { BgsPlayerEntity } from '../../bgs-player-entity';\r\nimport { BoardEntity } from '../../board-entity';\r\nimport { hasStartOfCombatFromHand } from '../../cards/card.interface';\r\nimport { cardMappings } from '../../cards/impl/_card-mappings';\r\nimport { CardIds } from '../../services/card-ids';\r\nimport { FullGameState } from '../internal-game-state';\r\nimport { handleSummonsWhenSpace } from '../summon-when-space';\r\nimport { performStartOfCombatAction } from './soc-action-processor';\r\nimport { SoCInput } from './start-of-combat-input';\r\n\r\nexport const 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 = [\r\n\t\t// Hand triggers first\r\n\t\t...playerEntity.hand.filter((e) => hasStartOfCombatFromHand(cardMappings[e.cardId])),\r\n\t\t...playerBoard,\r\n\t];\r\n\tconst opponentAttackers = [\r\n\t\t...opponentEntity.hand.filter((e) => hasStartOfCombatFromHand(cardMappings[e.cardId])),\r\n\t\t...opponentBoard,\r\n\t];\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\tconst input = {\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: currentAttacker,\r\n\t\t\t\tgameState,\r\n\t\t\t};\r\n\t\t\tshouldUpdateNextPlayer = performStartOfCombatMinionsForPlayer(attacker, input);\r\n\t\t\tcurrentAttacker = input.currentAttacker;\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\tconst input = {\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: currentAttacker,\r\n\t\t\t\tgameState,\r\n\t\t\t};\r\n\t\t\tshouldUpdateNextPlayer = performStartOfCombatMinionsForPlayer(attacker, input);\r\n\t\t\tcurrentAttacker = input.currentAttacker;\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\tconst shouldRecomputeCurrentAttacker = handleSummonsWhenSpace(\r\n\t\tplayerBoard,\r\n\t\tplayerEntity,\r\n\t\topponentBoard,\r\n\t\topponentEntity,\r\n\t\tgameState,\r\n\t);\r\n\tif (shouldRecomputeCurrentAttacker) {\r\n\t\tcurrentAttacker =\r\n\t\t\tplayerBoard.length > opponentBoard.length\r\n\t\t\t\t? 0\r\n\t\t\t\t: opponentBoard.length > playerBoard.length\r\n\t\t\t\t? 1\r\n\t\t\t\t: Math.round(Math.random());\r\n\t}\r\n\treturn currentAttacker;\r\n};\r\n\r\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\tconst loops = input.playerEntity.trinkets?.some((t) => t.cardId === CardIds.ValdrakkenWindChimes_BG32_MagicItem_365)\r\n\t\t? 2\r\n\t\t: 1;\r\n\tlet hasProcessed = false;\r\n\tfor (let i = 0; i < loops; i++) {\r\n\t\tif (input.playerEntity.startOfCombatDone) {\r\n\t\t\treturn false;\r\n\t\t}\r\n\r\n\t\thasProcessed = performStartOfCombatAction(minion.cardId, minion, input, true) || hasProcessed;\r\n\t}\r\n\treturn hasProcessed;\r\n};\r\n"]}
|
|
@@ -44,7 +44,15 @@ const handleStartOfCombatQuestRewards = (playerEntity, playerBoard, opponentEnti
|
|
|
44
44
|
playerIsFriendly: true,
|
|
45
45
|
});
|
|
46
46
|
}
|
|
47
|
-
(0, summon_when_space_1.handleSummonsWhenSpace)(playerBoard, playerEntity, opponentBoard, opponentEntity, gameState);
|
|
47
|
+
const shouldRecomputeCurrentAttacker = (0, summon_when_space_1.handleSummonsWhenSpace)(playerBoard, playerEntity, opponentBoard, opponentEntity, gameState);
|
|
48
|
+
if (shouldRecomputeCurrentAttacker) {
|
|
49
|
+
currentAttacker =
|
|
50
|
+
playerBoard.length > opponentBoard.length
|
|
51
|
+
? 0
|
|
52
|
+
: opponentBoard.length > playerBoard.length
|
|
53
|
+
? 1
|
|
54
|
+
: Math.round(Math.random());
|
|
55
|
+
}
|
|
48
56
|
return currentAttacker;
|
|
49
57
|
};
|
|
50
58
|
exports.handleStartOfCombatQuestRewards = handleStartOfCombatQuestRewards;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"soc-quest-reward.js","sourceRoot":"","sources":["../../../src/simulation/start-of-combat/soc-quest-reward.ts"],"names":[],"mappings":";;;AAIA,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,EAAE,aAAa;YAC1B,cAAc,EAAE,YAAY;YAC5B,aAAa,EAAE,WAAW;YAC1B,eAAe;YACf,SAAS;YACT,gBAAgB,EAAE,KAAK;SACvB,CAAC,CAAC;KACH;SAAM;QACN,eAAe,GAAG,wCAAwC,CAAC;YAC1D,YAAY,EAAE,cAAc;YAC5B,WAAW,EAAE,aAAa;YAC1B,cAAc,EAAE,YAAY;YAC5B,aAAa,EAAE,WAAW;YAC1B,eAAe;YACf,SAAS;YACT,gBAAgB,EAAE,KAAK;SACvB,CAAC,CAAC;QACH,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;KACH;IAED,IAAA,0CAAsB,
|
|
1
|
+
{"version":3,"file":"soc-quest-reward.js","sourceRoot":"","sources":["../../../src/simulation/start-of-combat/soc-quest-reward.ts"],"names":[],"mappings":";;;AAIA,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,EAAE,aAAa;YAC1B,cAAc,EAAE,YAAY;YAC5B,aAAa,EAAE,WAAW;YAC1B,eAAe;YACf,SAAS;YACT,gBAAgB,EAAE,KAAK;SACvB,CAAC,CAAC;KACH;SAAM;QACN,eAAe,GAAG,wCAAwC,CAAC;YAC1D,YAAY,EAAE,cAAc;YAC5B,WAAW,EAAE,aAAa;YAC1B,cAAc,EAAE,YAAY;YAC5B,aAAa,EAAE,WAAW;YAC1B,eAAe;YACf,SAAS;YACT,gBAAgB,EAAE,KAAK;SACvB,CAAC,CAAC;QACH,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;KACH;IAED,MAAM,8BAA8B,GAAG,IAAA,0CAAsB,EAC5D,WAAW,EACX,YAAY,EACZ,aAAa,EACb,cAAc,EACd,SAAS,CACT,CAAC;IACF,IAAI,8BAA8B,EAAE;QACnC,eAAe;YACd,WAAW,CAAC,MAAM,GAAG,aAAa,CAAC,MAAM;gBACxC,CAAC,CAAC,CAAC;gBACH,CAAC,CAAC,aAAa,CAAC,MAAM,GAAG,WAAW,CAAC,MAAM;oBAC3C,CAAC,CAAC,CAAC;oBACH,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;KAC9B;IACD,OAAO,eAAe,CAAC;AACxB,CAAC,CAAC;AAhEW,QAAA,+BAA+B,mCAgE1C;AAEF,MAAM,wCAAwC,GAAG,CAAC,KAAe,EAAU,EAAE;;IAC5E,MAAM,KAAK,GAAG,CAAA,MAAA,KAAK,CAAC,YAAY,CAAC,QAAQ,0CAAE,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,yBAAoD,CAAC;QACnH,CAAC,CAAC,CAAC;QACH,CAAC,CAAC,CAAC,CAAC;IACL,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,EAAE,CAAC,EAAE,EAAE;QAC/B,IAAI,KAAK,CAAC,YAAY,CAAC,iBAAiB,EAAE;YACzC,OAAO,KAAK,CAAC,eAAe,CAAC;SAC7B;QAED,KAAK,MAAM,MAAM,IAAI,KAAK,CAAC,YAAY,CAAC,YAAY,EAAE;YACrD,IAAA,iDAA0B,EAAC,MAAM,EAAE,KAAK,CAAC,YAAY,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;SACrE;KACD;IAED,OAAO,KAAK,CAAC,eAAe,CAAC;AAC9B,CAAC,CAAC","sourcesContent":["import { BgsPlayerEntity } from '../../bgs-player-entity';\r\nimport { BoardEntity } from '../../board-entity';\r\nimport { CardIds } from '../../services/card-ids';\r\nimport { FullGameState } from '../internal-game-state';\r\nimport { handleSummonsWhenSpace } from '../summon-when-space';\r\nimport { performStartOfCombatAction } from './soc-action-processor';\r\nimport { SoCInput } from './start-of-combat-input';\r\n\r\nexport const 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\tconst shouldRecomputeCurrentAttacker = handleSummonsWhenSpace(\r\n\t\tplayerBoard,\r\n\t\tplayerEntity,\r\n\t\topponentBoard,\r\n\t\topponentEntity,\r\n\t\tgameState,\r\n\t);\r\n\tif (shouldRecomputeCurrentAttacker) {\r\n\t\tcurrentAttacker =\r\n\t\t\tplayerBoard.length > opponentBoard.length\r\n\t\t\t\t? 0\r\n\t\t\t\t: opponentBoard.length > playerBoard.length\r\n\t\t\t\t? 1\r\n\t\t\t\t: Math.round(Math.random());\r\n\t}\r\n\treturn currentAttacker;\r\n};\r\n\r\nconst handleStartOfCombatQuestRewardsForPlayer = (input: SoCInput): number => {\r\n\tconst loops = input.playerEntity.trinkets?.some((t) => t.cardId === CardIds.ValdrakkenWindChimes_BG32_MagicItem_365)\r\n\t\t? 2\r\n\t\t: 1;\r\n\tfor (let i = 0; i < loops; i++) {\r\n\t\tif (input.playerEntity.startOfCombatDone) {\r\n\t\t\treturn input.currentAttacker;\r\n\t\t}\r\n\r\n\t\tfor (const reward of input.playerEntity.questRewards) {\r\n\t\t\tperformStartOfCombatAction(reward, input.playerEntity, input, false);\r\n\t\t}\r\n\t}\r\n\r\n\treturn input.currentAttacker;\r\n};\r\n"]}
|
|
@@ -44,7 +44,15 @@ const handleStartOfCombatSecrets = (playerEntity, playerBoard, opponentEntity, o
|
|
|
44
44
|
playerIsFriendly: true,
|
|
45
45
|
});
|
|
46
46
|
}
|
|
47
|
-
(0, summon_when_space_1.handleSummonsWhenSpace)(playerBoard, playerEntity, opponentBoard, opponentEntity, gameState);
|
|
47
|
+
const shouldRecomputeCurrentAttacker = (0, summon_when_space_1.handleSummonsWhenSpace)(playerBoard, playerEntity, opponentBoard, opponentEntity, gameState);
|
|
48
|
+
if (shouldRecomputeCurrentAttacker) {
|
|
49
|
+
currentAttacker =
|
|
50
|
+
playerBoard.length > opponentBoard.length
|
|
51
|
+
? 0
|
|
52
|
+
: opponentBoard.length > playerBoard.length
|
|
53
|
+
? 1
|
|
54
|
+
: Math.round(Math.random());
|
|
55
|
+
}
|
|
48
56
|
return currentAttacker;
|
|
49
57
|
};
|
|
50
58
|
exports.handleStartOfCombatSecrets = handleStartOfCombatSecrets;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"soc-secret.js","sourceRoot":"","sources":["../../../src/simulation/start-of-combat/soc-secret.ts"],"names":[],"mappings":";;;AAIA,4DAA8D;AAC9D,iEAAoE;AAG7D,MAAM,0BAA0B,GAAG,CACzC,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,mCAAmC,CAAC;YACrD,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,mCAAmC,CAAC;YACrD,YAAY,EAAE,cAAc;YAC5B,WAAW,EAAE,aAAa;YAC1B,cAAc,EAAE,YAAY;YAC5B,aAAa,EAAE,WAAW;YAC1B,eAAe;YACf,SAAS;YACT,gBAAgB,EAAE,KAAK;SACvB,CAAC,CAAC;KACH;SAAM;QACN,eAAe,GAAG,mCAAmC,CAAC;YACrD,YAAY,EAAE,cAAc;YAC5B,WAAW,EAAE,aAAa;YAC1B,cAAc,EAAE,YAAY;YAC5B,aAAa,EAAE,WAAW;YAC1B,eAAe;YACf,SAAS;YACT,gBAAgB,EAAE,KAAK;SACvB,CAAC,CAAC;QACH,eAAe,GAAG,mCAAmC,CAAC;YACrD,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;KACH;IACD,IAAA,0CAAsB,
|
|
1
|
+
{"version":3,"file":"soc-secret.js","sourceRoot":"","sources":["../../../src/simulation/start-of-combat/soc-secret.ts"],"names":[],"mappings":";;;AAIA,4DAA8D;AAC9D,iEAAoE;AAG7D,MAAM,0BAA0B,GAAG,CACzC,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,mCAAmC,CAAC;YACrD,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,mCAAmC,CAAC;YACrD,YAAY,EAAE,cAAc;YAC5B,WAAW,EAAE,aAAa;YAC1B,cAAc,EAAE,YAAY;YAC5B,aAAa,EAAE,WAAW;YAC1B,eAAe;YACf,SAAS;YACT,gBAAgB,EAAE,KAAK;SACvB,CAAC,CAAC;KACH;SAAM;QACN,eAAe,GAAG,mCAAmC,CAAC;YACrD,YAAY,EAAE,cAAc;YAC5B,WAAW,EAAE,aAAa;YAC1B,cAAc,EAAE,YAAY;YAC5B,aAAa,EAAE,WAAW;YAC1B,eAAe;YACf,SAAS;YACT,gBAAgB,EAAE,KAAK;SACvB,CAAC,CAAC;QACH,eAAe,GAAG,mCAAmC,CAAC;YACrD,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;KACH;IACD,MAAM,8BAA8B,GAAG,IAAA,0CAAsB,EAC5D,WAAW,EACX,YAAY,EACZ,aAAa,EACb,cAAc,EACd,SAAS,CACT,CAAC;IACF,IAAI,8BAA8B,EAAE;QACnC,eAAe;YACd,WAAW,CAAC,MAAM,GAAG,aAAa,CAAC,MAAM;gBACxC,CAAC,CAAC,CAAC;gBACH,CAAC,CAAC,aAAa,CAAC,MAAM,GAAG,WAAW,CAAC,MAAM;oBAC3C,CAAC,CAAC,CAAC;oBACH,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;KAC9B;IACD,OAAO,eAAe,CAAC;AACxB,CAAC,CAAC;AA/DW,QAAA,0BAA0B,8BA+DrC;AAEF,MAAM,mCAAmC,GAAG,CAAC,KAAe,EAAU,EAAE;;IACvE,MAAM,KAAK,GAAG,CAAA,MAAA,KAAK,CAAC,YAAY,CAAC,QAAQ,0CAAE,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,yBAAoD,CAAC;QACnH,CAAC,CAAC,CAAC;QACH,CAAC,CAAC,CAAC,CAAC;IACL,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,EAAE,CAAC,EAAE,EAAE;QAC/B,IAAI,KAAK,CAAC,YAAY,CAAC,iBAAiB,EAAE;YACzC,OAAO,KAAK,CAAC,eAAe,CAAC;SAC7B;QACD,KAAK,MAAM,MAAM,IAAI,MAAA,KAAK,CAAC,YAAY,CAAC,OAAO,mCAAI,EAAE,EAAE;YACtD,IAAA,iDAA0B,EAAC,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;SAChE;KACD;IACD,OAAO,KAAK,CAAC,eAAe,CAAC;AAC9B,CAAC,CAAC","sourcesContent":["import { BgsPlayerEntity } from '../../bgs-player-entity';\r\nimport { BoardEntity } from '../../board-entity';\r\nimport { CardIds } from '../../services/card-ids';\r\nimport { FullGameState } from '../internal-game-state';\r\nimport { handleSummonsWhenSpace } from '../summon-when-space';\r\nimport { performStartOfCombatAction } from './soc-action-processor';\r\nimport { SoCInput } from './start-of-combat-input';\r\n\r\nexport const handleStartOfCombatSecrets = (\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 = handleStartOfCombatSecretsForPlayer({\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 = handleStartOfCombatSecretsForPlayer({\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 = handleStartOfCombatSecretsForPlayer({\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 = handleStartOfCombatSecretsForPlayer({\r\n\t\t\tplayerEntity: playerEntity,\r\n\t\t\tplayerBoard: playerBoard,\r\n\t\t\topponentEntity: opponentEntity,\r\n\t\t\topponentBoard: opponentBoard,\r\n\t\t\tcurrentAttacker,\r\n\t\t\tgameState,\r\n\t\t\tplayerIsFriendly: true,\r\n\t\t});\r\n\t}\r\n\tconst shouldRecomputeCurrentAttacker = handleSummonsWhenSpace(\r\n\t\tplayerBoard,\r\n\t\tplayerEntity,\r\n\t\topponentBoard,\r\n\t\topponentEntity,\r\n\t\tgameState,\r\n\t);\r\n\tif (shouldRecomputeCurrentAttacker) {\r\n\t\tcurrentAttacker =\r\n\t\t\tplayerBoard.length > opponentBoard.length\r\n\t\t\t\t? 0\r\n\t\t\t\t: opponentBoard.length > playerBoard.length\r\n\t\t\t\t? 1\r\n\t\t\t\t: Math.round(Math.random());\r\n\t}\r\n\treturn currentAttacker;\r\n};\r\n\r\nconst handleStartOfCombatSecretsForPlayer = (input: SoCInput): number => {\r\n\tconst loops = input.playerEntity.trinkets?.some((t) => t.cardId === CardIds.ValdrakkenWindChimes_BG32_MagicItem_365)\r\n\t\t? 2\r\n\t\t: 1;\r\n\tfor (let i = 0; i < loops; i++) {\r\n\t\tif (input.playerEntity.startOfCombatDone) {\r\n\t\t\treturn input.currentAttacker;\r\n\t\t}\r\n\t\tfor (const secret of input.playerEntity.secrets ?? []) {\r\n\t\t\tperformStartOfCombatAction(secret.cardId, secret, input, false);\r\n\t\t}\r\n\t}\r\n\treturn input.currentAttacker;\r\n};\r\n"]}
|
|
@@ -44,7 +44,15 @@ const handleStartOfCombatTrinkets = (playerEntity, playerBoard, opponentEntity,
|
|
|
44
44
|
playerIsFriendly: true,
|
|
45
45
|
});
|
|
46
46
|
}
|
|
47
|
-
(0, summon_when_space_1.handleSummonsWhenSpace)(playerBoard, playerEntity, opponentBoard, opponentEntity, gameState);
|
|
47
|
+
const shouldRecomputeCurrentAttacker = (0, summon_when_space_1.handleSummonsWhenSpace)(playerBoard, playerEntity, opponentBoard, opponentEntity, gameState);
|
|
48
|
+
if (shouldRecomputeCurrentAttacker) {
|
|
49
|
+
currentAttacker =
|
|
50
|
+
playerBoard.length > opponentBoard.length
|
|
51
|
+
? 0
|
|
52
|
+
: opponentBoard.length > playerBoard.length
|
|
53
|
+
? 1
|
|
54
|
+
: Math.round(Math.random());
|
|
55
|
+
}
|
|
48
56
|
return currentAttacker;
|
|
49
57
|
};
|
|
50
58
|
exports.handleStartOfCombatTrinkets = handleStartOfCombatTrinkets;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"soc-trinket.js","sourceRoot":"","sources":["../../../src/simulation/start-of-combat/soc-trinket.ts"],"names":[],"mappings":";;;AAIA,4DAA8D;AAC9D,iEAAoE;AAG7D,MAAM,2BAA2B,GAAG,CAC1C,YAA6B,EAC7B,WAA0B,EAC1B,cAA+B,EAC/B,aAA4B,EAC5B,eAAuB,EACvB,SAAwB,EACf,EAAE;IACX,IAAI,IAAI,CAAC,MAAM,EAAE,GAAG,GAAG,EAAE;QACxB,eAAe,GAAG,oCAAoC,CAAC;YACtD,YAAY,EAAE,YAAY;YAC1B,WAAW,EAAE,WAAW;YACxB,cAAc,EAAE,cAAc;YAC9B,aAAa,EAAE,aAAa;YAC5B,eAAe;YACf,SAAS;YACT,gBAAgB,EAAE,IAAI;SACtB,CAAC,CAAC;QACH,eAAe,GAAG,oCAAoC,CAAC;YACtD,YAAY,EAAE,cAAc;YAC5B,WAAW,EAAE,aAAa;YAC1B,cAAc,EAAE,YAAY;YAC5B,aAAa,EAAE,WAAW;YAC1B,eAAe;YACf,SAAS;YACT,gBAAgB,EAAE,KAAK;SACvB,CAAC,CAAC;KACH;SAAM;QACN,eAAe,GAAG,oCAAoC,CAAC;YACtD,YAAY,EAAE,cAAc;YAC5B,WAAW,EAAE,aAAa;YAC1B,cAAc,EAAE,YAAY;YAC5B,aAAa,EAAE,WAAW;YAC1B,eAAe;YACf,SAAS;YACT,gBAAgB,EAAE,KAAK;SACvB,CAAC,CAAC;QACH,eAAe,GAAG,oCAAoC,CAAC;YACtD,YAAY,EAAE,YAAY;YAC1B,WAAW,EAAE,WAAW;YACxB,cAAc,EAAE,cAAc;YAC9B,aAAa,EAAE,aAAa;YAC5B,eAAe;YACf,SAAS;YACT,gBAAgB,EAAE,IAAI;SACtB,CAAC,CAAC;KACH;IACD,IAAA,0CAAsB,
|
|
1
|
+
{"version":3,"file":"soc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;YACd,WAAW,CAAC,MAAM,GAAG,aAAa,CAAC,MAAM;gBACxC,CAAC,CAAC,CAAC;gBACH,CAAC,CAAC,aAAa,CAAC,MAAM,GAAG,WAAW,CAAC,MAAM;oBAC3C,CAAC,CAAC,CAAC;oBACH,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;KAC9B;IACD,OAAO,eAAe,CAAC;AACxB,CAAC,CAAC;AA/DW,QAAA,2BAA2B,+BA+DtC;AAEF,MAAM,oCAAoC,GAAG,CAAC,KAAe,EAAU,EAAE;;IACxE,IAAI,KAAK,CAAC,YAAY,CAAC,iBAAiB,EAAE;QACzC,OAAO,KAAK,CAAC,eAAe,CAAC;KAC7B;IAED,MAAM,KAAK,GAAG,CAAA,MAAA,KAAK,CAAC,YAAY,CAAC,QAAQ,0CAAE,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,yBAAoD,CAAC;QACnH,CAAC,CAAC,CAAC;QACH,CAAC,CAAC,CAAC,CAAC;IACL,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,EAAE,CAAC,EAAE,EAAE;QAC/B,KAAK,MAAM,OAAO,IAAI,KAAK,CAAC,YAAY,CAAC,QAAQ,EAAE;YAClD,IAAA,iDAA0B,EAAC,OAAO,CAAC,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;SAClE;KACD;IAED,OAAO,KAAK,CAAC,eAAe,CAAC;AAC9B,CAAC,CAAC","sourcesContent":["import { BgsPlayerEntity } from '../../bgs-player-entity';\r\nimport { BoardEntity } from '../../board-entity';\r\nimport { CardIds } from '../../services/card-ids';\r\nimport { FullGameState } from '../internal-game-state';\r\nimport { handleSummonsWhenSpace } from '../summon-when-space';\r\nimport { performStartOfCombatAction } from './soc-action-processor';\r\nimport { SoCInput } from './start-of-combat-input';\r\n\r\nexport const handleStartOfCombatTrinkets = (\r\n\tplayerEntity: BgsPlayerEntity,\r\n\tplayerBoard: BoardEntity[],\r\n\topponentEntity: BgsPlayerEntity,\r\n\topponentBoard: BoardEntity[],\r\n\tcurrentAttacker: number,\r\n\tgameState: FullGameState,\r\n): number => {\r\n\tif (Math.random() < 0.5) {\r\n\t\tcurrentAttacker = handleStartOfCombatTrinketsForPlayer({\r\n\t\t\tplayerEntity: playerEntity,\r\n\t\t\tplayerBoard: playerBoard,\r\n\t\t\topponentEntity: opponentEntity,\r\n\t\t\topponentBoard: opponentBoard,\r\n\t\t\tcurrentAttacker,\r\n\t\t\tgameState,\r\n\t\t\tplayerIsFriendly: true,\r\n\t\t});\r\n\t\tcurrentAttacker = handleStartOfCombatTrinketsForPlayer({\r\n\t\t\tplayerEntity: opponentEntity,\r\n\t\t\tplayerBoard: opponentBoard,\r\n\t\t\topponentEntity: playerEntity,\r\n\t\t\topponentBoard: playerBoard,\r\n\t\t\tcurrentAttacker,\r\n\t\t\tgameState,\r\n\t\t\tplayerIsFriendly: false,\r\n\t\t});\r\n\t} else {\r\n\t\tcurrentAttacker = handleStartOfCombatTrinketsForPlayer({\r\n\t\t\tplayerEntity: opponentEntity,\r\n\t\t\tplayerBoard: opponentBoard,\r\n\t\t\topponentEntity: playerEntity,\r\n\t\t\topponentBoard: playerBoard,\r\n\t\t\tcurrentAttacker,\r\n\t\t\tgameState,\r\n\t\t\tplayerIsFriendly: false,\r\n\t\t});\r\n\t\tcurrentAttacker = handleStartOfCombatTrinketsForPlayer({\r\n\t\t\tplayerEntity: playerEntity,\r\n\t\t\tplayerBoard: playerBoard,\r\n\t\t\topponentEntity: opponentEntity,\r\n\t\t\topponentBoard: opponentBoard,\r\n\t\t\tcurrentAttacker,\r\n\t\t\tgameState,\r\n\t\t\tplayerIsFriendly: true,\r\n\t\t});\r\n\t}\r\n\tconst shouldRecomputeCurrentAttacker = handleSummonsWhenSpace(\r\n\t\tplayerBoard,\r\n\t\tplayerEntity,\r\n\t\topponentBoard,\r\n\t\topponentEntity,\r\n\t\tgameState,\r\n\t);\r\n\tif (shouldRecomputeCurrentAttacker) {\r\n\t\tcurrentAttacker =\r\n\t\t\tplayerBoard.length > opponentBoard.length\r\n\t\t\t\t? 0\r\n\t\t\t\t: opponentBoard.length > playerBoard.length\r\n\t\t\t\t? 1\r\n\t\t\t\t: Math.round(Math.random());\r\n\t}\r\n\treturn currentAttacker;\r\n};\r\n\r\nconst handleStartOfCombatTrinketsForPlayer = (input: SoCInput): number => {\r\n\tif (input.playerEntity.startOfCombatDone) {\r\n\t\treturn input.currentAttacker;\r\n\t}\r\n\r\n\tconst loops = input.playerEntity.trinkets?.some((t) => t.cardId === CardIds.ValdrakkenWindChimes_BG32_MagicItem_365)\r\n\t\t? 2\r\n\t\t: 1;\r\n\tfor (let i = 0; i < loops; i++) {\r\n\t\tfor (const trinket of input.playerEntity.trinkets) {\r\n\t\t\tperformStartOfCombatAction(trinket.cardId, trinket, input, false);\r\n\t\t}\r\n\t}\r\n\r\n\treturn input.currentAttacker;\r\n};\r\n"]}
|
package/dist/simulation/stats.js
CHANGED
|
@@ -163,7 +163,9 @@ const onStatUpdateMinions = (entity, attackAmount, healthAmount, friendlyBoard,
|
|
|
163
163
|
if ((0, utils_1.hasCorrectTribe)(entity, friendlyBoardHero, reference_data_1.Race.ELEMENTAL, gameState.anomalies, gameState.allCards)) {
|
|
164
164
|
const masterOfRealities = friendlyBoard.filter((e) => e.cardId === "BG21_036" || e.cardId === "BG21_036_G");
|
|
165
165
|
masterOfRealities.forEach((master) => {
|
|
166
|
-
|
|
166
|
+
const baseBuff = 2;
|
|
167
|
+
const mult = master.cardId === "BG21_036_G" ? 2 : 1;
|
|
168
|
+
(0, exports.modifyStats)(master, master, baseBuff * mult, baseBuff * mult, friendlyBoard, friendlyBoardHero, gameState);
|
|
167
169
|
});
|
|
168
170
|
}
|
|
169
171
|
const tentaclesOfCthun = friendlyBoard
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stats.js","sourceR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BAAyC,CAC3G,CAAC;QACF,iBAAiB,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE;YACpC,IAAA,mBAAW,EACV,MAAM,EACN,MAAM,EACN,MAAM,CAAC,MAAM,iBAAyC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAC9D,MAAM,CAAC,MAAM,iBAAyC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAC9D,aAAa,EACb,iBAAiB,EACjB,SAAS,CACT,CAAC;QACH,CAAC,CAAC,CAAC;KACH;IACD,MAAM,gBAAgB,GAAG,aAAa;SACpC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,KAAK,MAAM,CAAC,QAAQ,CAAC;SAC7C,MAAM,CACN,CAAC,CAAC,EAAE,EAAE,CACL,CAAC,CAAC,MAAM,iCAAuD;QAC/D,CAAC,CAAC,MAAM,mCAAyD,CAClE,CAAC;IACH,gBAAgB,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE;QACrC,QAAQ,CAAC,MAAM,IAAI,QAAQ,CAAC,MAAM,mCAAyD,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACpG,QAAQ,CAAC,MAAM,IAAI,QAAQ,CAAC,MAAM,mCAAyD,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACrG,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { CardIds } from '../services/card-ids';\nimport { Race } from '@firestone-hs/reference-data';\nimport { BgsHeroPower, BgsPlayerEntity, BoardTrinket } from '../bgs-player-entity';\r\nimport { BoardEntity } from '../board-entity';\r\nimport { BoardSecret } from '../board-secret';\r\nimport { hasOnStatsChanged } from '../cards/card.interface';\r\nimport { cardMappings } from '../cards/impl/_card-mappings';\r\nimport { hasCorrectTribe } from '../utils';\r\nimport { applyAurasToSelf, removeAurasFromSelf } from './add-minion-to-board';\r\nimport { getNeighbours } from './attack';\r\nimport { FullGameState, PlayerState } from './internal-game-state';\r\nimport { onQuestProgressUpdated } from './quest';\r\n\r\nexport const setEntityStats = (\r\n\tentity: BoardEntity,\r\n\tattack: number | null,\r\n\thealth: number | null,\r\n\tboard: BoardEntity[],\r\n\tboardHero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\tremoveAurasFromSelf(entity, board, boardHero, gameState);\r\n\tif (attack !== null) {\r\n\t\tentity.attack = attack;\r\n\t\tentity.maxAttack = attack;\r\n\t}\r\n\tif (health !== null) {\r\n\t\tentity.health = health;\r\n\t\tentity.maxHealth = health;\r\n\t}\r\n\tapplyAurasToSelf(entity, board, boardHero, gameState);\r\n};\r\n\r\nexport const modifyStats = (\r\n\tentity: BoardEntity,\r\n\tsource: BoardEntity | BoardSecret | BoardTrinket | BgsPlayerEntity | BgsHeroPower,\r\n\tattackAmount: number,\r\n\thealthAmount: number,\r\n\tfriendlyBoard: BoardEntity[],\r\n\tfriendlyBoardHero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n\tregisterSpectator = true,\r\n\t// All stat modifications become enchantments, excepted the ones coming from gilding a minion\r\n\tisEnchantment = true,\r\n): void => {\r\n\tconst debug = attackAmount === 10;\r\n\tif (attackAmount === 0 && healthAmount === 0) {\r\n\t\treturn;\r\n\t}\r\n\r\n\tif (entity.cardId === CardIds.LocPrince_BG29_889 || entity.cardId === CardIds.LocPrince_BG29_889_G) {\r\n\t\tconst buff = entity.cardId === CardIds.LocPrince_BG29_889_G ? 2 : 1;\r\n\t\tattackAmount += 2 * buff;\r\n\t\thealthAmount += 1 * buff;\r\n\t}\r\n\r\n\tif (\r\n\t\tentity?.entityId !== source?.entityId &&\r\n\t\thasCorrectTribe(\r\n\t\t\tsource as BoardEntity,\r\n\t\t\tfriendlyBoardHero,\r\n\t\t\tRace.ELEMENTAL,\r\n\t\t\tgameState.anomalies,\r\n\t\t\tgameState.allCards,\r\n\t\t) &&\r\n\t\t// Safeguard\r\n\t\tattackAmount >= 0 &&\r\n\t\thealthAmount >= 0\r\n\t) {\r\n\t\tattackAmount += friendlyBoardHero.globalInfo.ElementalAttackBuff;\r\n\t\thealthAmount += friendlyBoardHero.globalInfo.ElementalHealthBuff;\r\n\t}\r\n\r\n\t// The only spell for now that grants stats is the Fleeting Vigor secret, and the stats it grants\r\n\t// are in scriptDataNum1 and 2\r\n\t// if (\r\n\t// \tentity?.entityId !== source?.entityId &&\r\n\t// \tgameState.allCards.getCard(source?.cardId).type?.toUpperCase() === CardType[CardType.BATTLEGROUND_SPELL] &&\r\n\t// \t// Safeguard\r\n\t// \tattackAmount >= 0 &&\r\n\t// \thealthAmount >= 0\r\n\t// ) {\r\n\t// \tattackAmount += friendlyBoardHero.globalInfo.TavernSpellAttackBuff;\r\n\t// \thealthAmount += friendlyBoardHero.globalInfo.TavernSpellHealthBuff;\r\n\t// }\r\n\r\n\tconst otherBoardHero: BgsPlayerEntity =\r\n\t\tgameState.gameState.player.player === friendlyBoardHero\r\n\t\t\t? gameState.gameState.opponent.player\r\n\t\t\t: gameState.gameState.player.player;\r\n\r\n\tconst neighbours = getNeighbours(friendlyBoard, entity);\r\n\tconst poetMultipliers =\r\n\t\tisEnchantment &&\r\n\t\thasCorrectTribe(entity, friendlyBoardHero, Race.DRAGON, gameState.anomalies, gameState.allCards)\r\n\t\t\t? neighbours.filter((e) => e.cardId === CardIds.PersistentPoet_BG29_813_G).length * 2 || 1\r\n\t\t\t: 1;\r\n\tconst tarecgosaMultiplier = isEnchantment && entity.cardId === CardIds.Tarecgosa_BG21_015_G ? 2 : 1;\r\n\r\n\tconst realAttackAmount = attackAmount * poetMultipliers * tarecgosaMultiplier;\r\n\tconst realHealthAmount = healthAmount * poetMultipliers * tarecgosaMultiplier;\r\n\r\n\tentity.attack = Math.max(0, entity.attack + realAttackAmount);\r\n\tentity.previousAttack = entity.attack;\r\n\tentity.pendingAttackBuffs = entity.pendingAttackBuffs || [];\r\n\tentity.pendingAttackBuffs.push(realAttackAmount);\r\n\tentity.health += realHealthAmount;\r\n\r\n\tif (realAttackAmount > 0) {\r\n\t\tentity.maxAttack += realAttackAmount;\r\n\r\n\t\tif (hasCorrectTribe(entity, friendlyBoardHero, Race.DRAGON, gameState.anomalies, gameState.allCards)) {\r\n\t\t\tif (entity.cardId !== CardIds.Stormbringer_BG26_966 && entity.cardId !== CardIds.Stormbringer_BG26_966_G) {\r\n\t\t\t\tconst stormbringers = friendlyBoard.filter(\r\n\t\t\t\t\t(e) => e.cardId === CardIds.Stormbringer_BG26_966 || e.cardId === CardIds.Stormbringer_BG26_966_G,\r\n\t\t\t\t);\r\n\t\t\t\tstormbringers.forEach((stormbringer) => {\r\n\t\t\t\t\tconst multiplier = stormbringer.cardId === CardIds.Stormbringer_BG26_966_G ? 2 : 1;\r\n\t\t\t\t\tstormbringer.attack += multiplier * realAttackAmount;\r\n\t\t\t\t\tgameState.spectator.registerPowerTarget(\r\n\t\t\t\t\t\tstormbringer,\r\n\t\t\t\t\t\tstormbringer,\r\n\t\t\t\t\t\tfriendlyBoard,\r\n\t\t\t\t\t\tfriendlyBoardHero,\r\n\t\t\t\t\t\totherBoardHero,\r\n\t\t\t\t\t);\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// Sinestra\r\n\t\tfriendlyBoard\r\n\t\t\t.filter(\r\n\t\t\t\t(e) =>\r\n\t\t\t\t\te.cardId === CardIds.LadySinestra_TB_BaconShop_HERO_52_Buddy ||\r\n\t\t\t\t\te.cardId === CardIds.LadySinestra_TB_BaconShop_HERO_52_Buddy_G,\r\n\t\t\t)\r\n\t\t\t.forEach((sinestra) => {\r\n\t\t\t\tconst buff = sinestra.cardId === CardIds.LadySinestra_TB_BaconShop_HERO_52_Buddy_G ? 2 : 1;\r\n\t\t\t\tentity.health += buff;\r\n\t\t\t\tgameState.spectator.registerPowerTarget(\r\n\t\t\t\t\tsinestra,\r\n\t\t\t\t\tentity,\r\n\t\t\t\t\tfriendlyBoard,\r\n\t\t\t\t\tfriendlyBoardHero,\r\n\t\t\t\t\totherBoardHero,\r\n\t\t\t\t);\r\n\t\t\t});\r\n\t}\r\n\r\n\tif (realHealthAmount > 0) {\r\n\t\tentity.maxHealth += realHealthAmount;\r\n\t\tconst titanicGuardians = friendlyBoard\r\n\t\t\t.filter((e) => e.entityId !== entity.entityId)\r\n\t\t\t.filter(\r\n\t\t\t\t(e) =>\r\n\t\t\t\t\te.cardId === CardIds.TitanicGuardian_TB_BaconShop_HERO_39_Buddy ||\r\n\t\t\t\t\te.cardId === CardIds.TitanicGuardian_TB_BaconShop_HERO_39_Buddy_G,\r\n\t\t\t);\r\n\t\ttitanicGuardians.forEach((guardian) => {\r\n\t\t\tconst buff =\r\n\t\t\t\t(guardian.cardId === CardIds.TitanicGuardian_TB_BaconShop_HERO_39_Buddy_G ? 2 : 1) * realHealthAmount;\r\n\t\t\tif (buff > 0) {\r\n\t\t\t\tguardian.health += buff;\r\n\t\t\t\tguardian.maxHealth += buff;\r\n\t\t\t}\r\n\t\t});\r\n\t}\r\n\r\n\tif (registerSpectator && !!source) {\r\n\t\tgameState.spectator.registerPowerTarget(source, entity, friendlyBoard, friendlyBoardHero, otherBoardHero);\r\n\t}\r\n\r\n\tif (\r\n\t\tentity.cardId === CardIds.Menagerist_AmalgamToken ||\r\n\t\tentity.cardId === CardIds.Amalgam ||\r\n\t\tentity.cardId === CardIds.Cuddlgam_TB_BaconShop_HP_033t_SKIN_A ||\r\n\t\tentity.cardId === CardIds.Cuddlgam_TB_BaconShop_HP_033t_SKIN_A_G ||\r\n\t\tentity.cardId === CardIds.AbominableAmalgam_TB_BaconShop_HP_033t_SKIN_D ||\r\n\t\tentity.cardId === CardIds.AbominableAmalgam_TB_BaconShop_HP_033t_SKIN_D_G\r\n\t) {\r\n\t\tconst mishmashes = friendlyBoard.filter(\r\n\t\t\t(e) =>\r\n\t\t\t\te.cardId === CardIds.Mishmash_TB_BaconShop_HERO_33_Buddy ||\r\n\t\t\t\te.cardId === CardIds.Mishmash_TB_BaconShop_HERO_33_Buddy_G,\r\n\t\t);\r\n\t\tmishmashes.forEach((mishmash) => {\r\n\t\t\tmodifyStats(\r\n\t\t\t\tmishmash,\r\n\t\t\t\tmishmash,\r\n\t\t\t\t(mishmash.cardId === CardIds.Mishmash_TB_BaconShop_HERO_33_Buddy_G ? 2 : 1) * realAttackAmount,\r\n\t\t\t\t(mishmash.cardId === CardIds.Mishmash_TB_BaconShop_HERO_33_Buddy_G ? 2 : 1) * realHealthAmount,\r\n\t\t\t\tfriendlyBoard,\r\n\t\t\t\tfriendlyBoardHero,\r\n\t\t\t\tgameState,\r\n\t\t\t);\r\n\t\t});\r\n\t}\r\n\r\n\tonStatsUpdate(\r\n\t\tentity,\r\n\t\trealAttackAmount,\r\n\t\trealHealthAmount,\r\n\t\tfriendlyBoard,\r\n\t\tfriendlyBoardHero,\r\n\t\totherBoardHero,\r\n\t\tgameState,\r\n\t);\r\n};\r\n\r\nconst onStatsUpdate = (\r\n\tentity: BoardEntity,\r\n\trealAttackAmount: number,\r\n\trealHealthAmount: number,\r\n\tfriendlyBoard: BoardEntity[],\r\n\tfriendlyHero: BgsPlayerEntity,\r\n\totherHero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\tonStatUpdateMinions(entity, realAttackAmount, realHealthAmount, friendlyBoard, friendlyHero, otherHero, gameState);\r\n\tonStatUpdateQuests(entity, friendlyBoard, friendlyHero, gameState);\r\n};\r\n\r\nexport const applyAfterStatsUpdate = (gameState: FullGameState) => {\r\n\tfor (const entity of gameState.gameState.player.board) {\r\n\t\tapplyAfterStatsUpdateForEntity(entity, gameState.gameState.player, gameState.gameState.opponent, gameState);\r\n\t}\r\n\tfor (const entity of gameState.gameState.opponent.board) {\r\n\t\tapplyAfterStatsUpdateForEntity(entity, gameState.gameState.opponent, gameState.gameState.player, gameState);\r\n\t}\r\n};\r\n\r\nconst applyAfterStatsUpdateForEntity = (\r\n\tentity: BoardEntity,\r\n\tplayerState: PlayerState,\r\n\topponentState: PlayerState,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\tentity.pendingAttackBuffs = [];\r\n};\r\n\r\nconst onStatUpdateQuests = (\r\n\tentity: BoardEntity,\r\n\tboard: BoardEntity[],\r\n\thero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\tconst quests = hero.questEntities ?? [];\r\n\tif (!quests.length) {\r\n\t\treturn;\r\n\t}\r\n\r\n\tfor (const quest of quests) {\r\n\t\tswitch (quest.CardId) {\r\n\t\t\tcase CardIds.FindTheMurderWeapon:\r\n\t\t\t\tonQuestProgressUpdated(hero, quest, board, gameState);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.PressureTheAuthorities:\r\n\t\t\t\tconst totalAttack = board.map((e) => e.attack).reduce((a, b) => a + b, 0);\r\n\t\t\t\tif (totalAttack >= 35) {\r\n\t\t\t\t\tonQuestProgressUpdated(hero, quest, board, gameState);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n};\r\n\r\nconst onStatUpdateMinions = (\r\n\tentity: BoardEntity,\r\n\tattackAmount: number,\r\n\thealthAmount: number,\r\n\tfriendlyBoard: BoardEntity[],\r\n\tfriendlyBoardHero: BgsPlayerEntity,\r\n\totherHero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\tif (attackAmount > 0 || healthAmount > 0) {\r\n\t\tfor (const boardEntity of friendlyBoard) {\r\n\t\t\tconst onStatsChangedImpl = cardMappings[boardEntity.cardId];\r\n\t\t\tif (hasOnStatsChanged(onStatsChangedImpl)) {\r\n\t\t\t\tonStatsChangedImpl.onStatsChanged(boardEntity, {\r\n\t\t\t\t\ttarget: entity,\r\n\t\t\t\t\tattackAmount: attackAmount,\r\n\t\t\t\t\thealthAmount: healthAmount,\r\n\t\t\t\t\tboard: friendlyBoard,\r\n\t\t\t\t\thero: friendlyBoardHero,\r\n\t\t\t\t\totherHero: otherHero,\r\n\t\t\t\t\tgameState: gameState,\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tif (hasCorrectTribe(entity, friendlyBoardHero, Race.ELEMENTAL, gameState.anomalies, gameState.allCards)) {\r\n\t\tconst masterOfRealities = friendlyBoard.filter(\r\n\t\t\t(e) => e.cardId === CardIds.MasterOfRealities_BG21_036 || e.cardId === CardIds.MasterOfRealities_BG21_036_G,\r\n\t\t);\r\n\t\tmasterOfRealities.forEach((master) => {\r\n\t\t\tmodifyStats(\r\n\t\t\t\tmaster,\r\n\t\t\t\tmaster,\r\n\t\t\t\tmaster.cardId === CardIds.MasterOfRealities_BG21_036_G ? 2 : 1,\r\n\t\t\t\tmaster.cardId === CardIds.MasterOfRealities_BG21_036_G ? 2 : 1,\r\n\t\t\t\tfriendlyBoard,\r\n\t\t\t\tfriendlyBoardHero,\r\n\t\t\t\tgameState,\r\n\t\t\t);\r\n\t\t});\r\n\t}\r\n\tconst tentaclesOfCthun = friendlyBoard\r\n\t\t.filter((e) => e.entityId !== entity.entityId)\r\n\t\t.filter(\r\n\t\t\t(e) =>\r\n\t\t\t\te.cardId === CardIds.TentacleOfCthun_TB_BaconShop_HERO_29_Buddy ||\r\n\t\t\t\te.cardId === CardIds.TentacleOfCthun_TB_BaconShop_HERO_29_Buddy_G,\r\n\t\t);\r\n\ttentaclesOfCthun.forEach((tentacle) => {\r\n\t\ttentacle.attack += tentacle.cardId === CardIds.TentacleOfCthun_TB_BaconShop_HERO_29_Buddy_G ? 2 : 1;\r\n\t\ttentacle.health += tentacle.cardId === CardIds.TentacleOfCthun_TB_BaconShop_HERO_29_Buddy_G ? 2 : 1;\r\n\t});\r\n};\r\n\r\nexport interface OnStatsChangedInput {\r\n\ttarget: BoardEntity;\r\n\tattackAmount: number;\r\n\thealthAmount: number;\r\n\tboard: BoardEntity[];\r\n\thero: BgsPlayerEntity;\r\n\totherHero: BgsPlayerEntity;\r\n\tgameState: Full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CAAC,CAAC,CAAC,MAAM,eAAuC,IAAI,CAAC,CAAC,MAAM,iBAAyC,CAC3G,CAAC;QACF,iBAAiB,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE;YACpC,MAAM,QAAQ,GAAG,CAAC,CAAC;YACnB,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,iBAAyC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YAC5E,IAAA,mBAAW,EAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,GAAG,IAAI,EAAE,QAAQ,GAAG,IAAI,EAAE,aAAa,EAAE,iBAAiB,EAAE,SAAS,CAAC,CAAC;QAC5G,CAAC,CAAC,CAAC;KACH;IACD,MAAM,gBAAgB,GAAG,aAAa;SACpC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,KAAK,MAAM,CAAC,QAAQ,CAAC;SAC7C,MAAM,CACN,CAAC,CAAC,EAAE,EAAE,CACL,CAAC,CAAC,MAAM,iCAAuD;QAC/D,CAAC,CAAC,MAAM,mCAAyD,CAClE,CAAC;IACH,gBAAgB,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE;QACrC,QAAQ,CAAC,MAAM,IAAI,QAAQ,CAAC,MAAM,mCAAyD,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACpG,QAAQ,CAAC,MAAM,IAAI,QAAQ,CAAC,MAAM,mCAAyD,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACrG,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { Race } from '@firestone-hs/reference-data';\r\nimport { BgsHeroPower, BgsPlayerEntity, BoardTrinket } from '../bgs-player-entity';\r\nimport { BoardEntity } from '../board-entity';\r\nimport { BoardSecret } from '../board-secret';\r\nimport { hasOnStatsChanged } from '../cards/card.interface';\r\nimport { cardMappings } from '../cards/impl/_card-mappings';\r\nimport { CardIds } from '../services/card-ids';\r\nimport { hasCorrectTribe } from '../utils';\r\nimport { applyAurasToSelf, removeAurasFromSelf } from './add-minion-to-board';\r\nimport { getNeighbours } from './attack';\r\nimport { FullGameState, PlayerState } from './internal-game-state';\r\nimport { onQuestProgressUpdated } from './quest';\r\n\r\nexport const setEntityStats = (\r\n\tentity: BoardEntity,\r\n\tattack: number | null,\r\n\thealth: number | null,\r\n\tboard: BoardEntity[],\r\n\tboardHero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\tremoveAurasFromSelf(entity, board, boardHero, gameState);\r\n\tif (attack !== null) {\r\n\t\tentity.attack = attack;\r\n\t\tentity.maxAttack = attack;\r\n\t}\r\n\tif (health !== null) {\r\n\t\tentity.health = health;\r\n\t\tentity.maxHealth = health;\r\n\t}\r\n\tapplyAurasToSelf(entity, board, boardHero, gameState);\r\n};\r\n\r\nexport const modifyStats = (\r\n\tentity: BoardEntity,\r\n\tsource: BoardEntity | BoardSecret | BoardTrinket | BgsPlayerEntity | BgsHeroPower,\r\n\tattackAmount: number,\r\n\thealthAmount: number,\r\n\tfriendlyBoard: BoardEntity[],\r\n\tfriendlyBoardHero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n\tregisterSpectator = true,\r\n\t// All stat modifications become enchantments, excepted the ones coming from gilding a minion\r\n\tisEnchantment = true,\r\n): void => {\r\n\tconst debug = attackAmount === 10;\r\n\tif (attackAmount === 0 && healthAmount === 0) {\r\n\t\treturn;\r\n\t}\r\n\r\n\tif (entity.cardId === CardIds.LocPrince_BG29_889 || entity.cardId === CardIds.LocPrince_BG29_889_G) {\r\n\t\tconst buff = entity.cardId === CardIds.LocPrince_BG29_889_G ? 2 : 1;\r\n\t\tattackAmount += 2 * buff;\r\n\t\thealthAmount += 1 * buff;\r\n\t}\r\n\r\n\tif (\r\n\t\tentity?.entityId !== source?.entityId &&\r\n\t\thasCorrectTribe(\r\n\t\t\tsource as BoardEntity,\r\n\t\t\tfriendlyBoardHero,\r\n\t\t\tRace.ELEMENTAL,\r\n\t\t\tgameState.anomalies,\r\n\t\t\tgameState.allCards,\r\n\t\t) &&\r\n\t\t// Safeguard\r\n\t\tattackAmount >= 0 &&\r\n\t\thealthAmount >= 0\r\n\t) {\r\n\t\tattackAmount += friendlyBoardHero.globalInfo.ElementalAttackBuff;\r\n\t\thealthAmount += friendlyBoardHero.globalInfo.ElementalHealthBuff;\r\n\t}\r\n\r\n\t// The only spell for now that grants stats is the Fleeting Vigor secret, and the stats it grants\r\n\t// are in scriptDataNum1 and 2\r\n\t// if (\r\n\t// \tentity?.entityId !== source?.entityId &&\r\n\t// \tgameState.allCards.getCard(source?.cardId).type?.toUpperCase() === CardType[CardType.BATTLEGROUND_SPELL] &&\r\n\t// \t// Safeguard\r\n\t// \tattackAmount >= 0 &&\r\n\t// \thealthAmount >= 0\r\n\t// ) {\r\n\t// \tattackAmount += friendlyBoardHero.globalInfo.TavernSpellAttackBuff;\r\n\t// \thealthAmount += friendlyBoardHero.globalInfo.TavernSpellHealthBuff;\r\n\t// }\r\n\r\n\tconst otherBoardHero: BgsPlayerEntity =\r\n\t\tgameState.gameState.player.player === friendlyBoardHero\r\n\t\t\t? gameState.gameState.opponent.player\r\n\t\t\t: gameState.gameState.player.player;\r\n\r\n\tconst neighbours = getNeighbours(friendlyBoard, entity);\r\n\tconst poetMultipliers =\r\n\t\tisEnchantment &&\r\n\t\thasCorrectTribe(entity, friendlyBoardHero, Race.DRAGON, gameState.anomalies, gameState.allCards)\r\n\t\t\t? neighbours.filter((e) => e.cardId === CardIds.PersistentPoet_BG29_813_G).length * 2 || 1\r\n\t\t\t: 1;\r\n\tconst tarecgosaMultiplier = isEnchantment && entity.cardId === CardIds.Tarecgosa_BG21_015_G ? 2 : 1;\r\n\r\n\tconst realAttackAmount = attackAmount * poetMultipliers * tarecgosaMultiplier;\r\n\tconst realHealthAmount = healthAmount * poetMultipliers * tarecgosaMultiplier;\r\n\r\n\tentity.attack = Math.max(0, entity.attack + realAttackAmount);\r\n\tentity.previousAttack = entity.attack;\r\n\tentity.pendingAttackBuffs = entity.pendingAttackBuffs || [];\r\n\tentity.pendingAttackBuffs.push(realAttackAmount);\r\n\tentity.health += realHealthAmount;\r\n\r\n\tif (realAttackAmount > 0) {\r\n\t\tentity.maxAttack += realAttackAmount;\r\n\r\n\t\tif (hasCorrectTribe(entity, friendlyBoardHero, Race.DRAGON, gameState.anomalies, gameState.allCards)) {\r\n\t\t\tif (entity.cardId !== CardIds.Stormbringer_BG26_966 && entity.cardId !== CardIds.Stormbringer_BG26_966_G) {\r\n\t\t\t\tconst stormbringers = friendlyBoard.filter(\r\n\t\t\t\t\t(e) => e.cardId === CardIds.Stormbringer_BG26_966 || e.cardId === CardIds.Stormbringer_BG26_966_G,\r\n\t\t\t\t);\r\n\t\t\t\tstormbringers.forEach((stormbringer) => {\r\n\t\t\t\t\tconst multiplier = stormbringer.cardId === CardIds.Stormbringer_BG26_966_G ? 2 : 1;\r\n\t\t\t\t\tstormbringer.attack += multiplier * realAttackAmount;\r\n\t\t\t\t\tgameState.spectator.registerPowerTarget(\r\n\t\t\t\t\t\tstormbringer,\r\n\t\t\t\t\t\tstormbringer,\r\n\t\t\t\t\t\tfriendlyBoard,\r\n\t\t\t\t\t\tfriendlyBoardHero,\r\n\t\t\t\t\t\totherBoardHero,\r\n\t\t\t\t\t);\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// Sinestra\r\n\t\tfriendlyBoard\r\n\t\t\t.filter(\r\n\t\t\t\t(e) =>\r\n\t\t\t\t\te.cardId === CardIds.LadySinestra_TB_BaconShop_HERO_52_Buddy ||\r\n\t\t\t\t\te.cardId === CardIds.LadySinestra_TB_BaconShop_HERO_52_Buddy_G,\r\n\t\t\t)\r\n\t\t\t.forEach((sinestra) => {\r\n\t\t\t\tconst buff = sinestra.cardId === CardIds.LadySinestra_TB_BaconShop_HERO_52_Buddy_G ? 2 : 1;\r\n\t\t\t\tentity.health += buff;\r\n\t\t\t\tgameState.spectator.registerPowerTarget(\r\n\t\t\t\t\tsinestra,\r\n\t\t\t\t\tentity,\r\n\t\t\t\t\tfriendlyBoard,\r\n\t\t\t\t\tfriendlyBoardHero,\r\n\t\t\t\t\totherBoardHero,\r\n\t\t\t\t);\r\n\t\t\t});\r\n\t}\r\n\r\n\tif (realHealthAmount > 0) {\r\n\t\tentity.maxHealth += realHealthAmount;\r\n\t\tconst titanicGuardians = friendlyBoard\r\n\t\t\t.filter((e) => e.entityId !== entity.entityId)\r\n\t\t\t.filter(\r\n\t\t\t\t(e) =>\r\n\t\t\t\t\te.cardId === CardIds.TitanicGuardian_TB_BaconShop_HERO_39_Buddy ||\r\n\t\t\t\t\te.cardId === CardIds.TitanicGuardian_TB_BaconShop_HERO_39_Buddy_G,\r\n\t\t\t);\r\n\t\ttitanicGuardians.forEach((guardian) => {\r\n\t\t\tconst buff =\r\n\t\t\t\t(guardian.cardId === CardIds.TitanicGuardian_TB_BaconShop_HERO_39_Buddy_G ? 2 : 1) * realHealthAmount;\r\n\t\t\tif (buff > 0) {\r\n\t\t\t\tguardian.health += buff;\r\n\t\t\t\tguardian.maxHealth += buff;\r\n\t\t\t}\r\n\t\t});\r\n\t}\r\n\r\n\tif (registerSpectator && !!source) {\r\n\t\tgameState.spectator.registerPowerTarget(source, entity, friendlyBoard, friendlyBoardHero, otherBoardHero);\r\n\t}\r\n\r\n\tif (\r\n\t\tentity.cardId === CardIds.Menagerist_AmalgamToken ||\r\n\t\tentity.cardId === CardIds.Amalgam ||\r\n\t\tentity.cardId === CardIds.Cuddlgam_TB_BaconShop_HP_033t_SKIN_A ||\r\n\t\tentity.cardId === CardIds.Cuddlgam_TB_BaconShop_HP_033t_SKIN_A_G ||\r\n\t\tentity.cardId === CardIds.AbominableAmalgam_TB_BaconShop_HP_033t_SKIN_D ||\r\n\t\tentity.cardId === CardIds.AbominableAmalgam_TB_BaconShop_HP_033t_SKIN_D_G\r\n\t) {\r\n\t\tconst mishmashes = friendlyBoard.filter(\r\n\t\t\t(e) =>\r\n\t\t\t\te.cardId === CardIds.Mishmash_TB_BaconShop_HERO_33_Buddy ||\r\n\t\t\t\te.cardId === CardIds.Mishmash_TB_BaconShop_HERO_33_Buddy_G,\r\n\t\t);\r\n\t\tmishmashes.forEach((mishmash) => {\r\n\t\t\tmodifyStats(\r\n\t\t\t\tmishmash,\r\n\t\t\t\tmishmash,\r\n\t\t\t\t(mishmash.cardId === CardIds.Mishmash_TB_BaconShop_HERO_33_Buddy_G ? 2 : 1) * realAttackAmount,\r\n\t\t\t\t(mishmash.cardId === CardIds.Mishmash_TB_BaconShop_HERO_33_Buddy_G ? 2 : 1) * realHealthAmount,\r\n\t\t\t\tfriendlyBoard,\r\n\t\t\t\tfriendlyBoardHero,\r\n\t\t\t\tgameState,\r\n\t\t\t);\r\n\t\t});\r\n\t}\r\n\r\n\tonStatsUpdate(\r\n\t\tentity,\r\n\t\trealAttackAmount,\r\n\t\trealHealthAmount,\r\n\t\tfriendlyBoard,\r\n\t\tfriendlyBoardHero,\r\n\t\totherBoardHero,\r\n\t\tgameState,\r\n\t);\r\n};\r\n\r\nconst onStatsUpdate = (\r\n\tentity: BoardEntity,\r\n\trealAttackAmount: number,\r\n\trealHealthAmount: number,\r\n\tfriendlyBoard: BoardEntity[],\r\n\tfriendlyHero: BgsPlayerEntity,\r\n\totherHero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\tonStatUpdateMinions(entity, realAttackAmount, realHealthAmount, friendlyBoard, friendlyHero, otherHero, gameState);\r\n\tonStatUpdateQuests(entity, friendlyBoard, friendlyHero, gameState);\r\n};\r\n\r\nexport const applyAfterStatsUpdate = (gameState: FullGameState) => {\r\n\tfor (const entity of gameState.gameState.player.board) {\r\n\t\tapplyAfterStatsUpdateForEntity(entity, gameState.gameState.player, gameState.gameState.opponent, gameState);\r\n\t}\r\n\tfor (const entity of gameState.gameState.opponent.board) {\r\n\t\tapplyAfterStatsUpdateForEntity(entity, gameState.gameState.opponent, gameState.gameState.player, gameState);\r\n\t}\r\n};\r\n\r\nconst applyAfterStatsUpdateForEntity = (\r\n\tentity: BoardEntity,\r\n\tplayerState: PlayerState,\r\n\topponentState: PlayerState,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\tentity.pendingAttackBuffs = [];\r\n};\r\n\r\nconst onStatUpdateQuests = (\r\n\tentity: BoardEntity,\r\n\tboard: BoardEntity[],\r\n\thero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\tconst quests = hero.questEntities ?? [];\r\n\tif (!quests.length) {\r\n\t\treturn;\r\n\t}\r\n\r\n\tfor (const quest of quests) {\r\n\t\tswitch (quest.CardId) {\r\n\t\t\tcase CardIds.FindTheMurderWeapon:\r\n\t\t\t\tonQuestProgressUpdated(hero, quest, board, gameState);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.PressureTheAuthorities:\r\n\t\t\t\tconst totalAttack = board.map((e) => e.attack).reduce((a, b) => a + b, 0);\r\n\t\t\t\tif (totalAttack >= 35) {\r\n\t\t\t\t\tonQuestProgressUpdated(hero, quest, board, gameState);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n};\r\n\r\nconst onStatUpdateMinions = (\r\n\tentity: BoardEntity,\r\n\tattackAmount: number,\r\n\thealthAmount: number,\r\n\tfriendlyBoard: BoardEntity[],\r\n\tfriendlyBoardHero: BgsPlayerEntity,\r\n\totherHero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\tif (attackAmount > 0 || healthAmount > 0) {\r\n\t\tfor (const boardEntity of friendlyBoard) {\r\n\t\t\tconst onStatsChangedImpl = cardMappings[boardEntity.cardId];\r\n\t\t\tif (hasOnStatsChanged(onStatsChangedImpl)) {\r\n\t\t\t\tonStatsChangedImpl.onStatsChanged(boardEntity, {\r\n\t\t\t\t\ttarget: entity,\r\n\t\t\t\t\tattackAmount: attackAmount,\r\n\t\t\t\t\thealthAmount: healthAmount,\r\n\t\t\t\t\tboard: friendlyBoard,\r\n\t\t\t\t\thero: friendlyBoardHero,\r\n\t\t\t\t\totherHero: otherHero,\r\n\t\t\t\t\tgameState: gameState,\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tif (hasCorrectTribe(entity, friendlyBoardHero, Race.ELEMENTAL, gameState.anomalies, gameState.allCards)) {\r\n\t\tconst masterOfRealities = friendlyBoard.filter(\r\n\t\t\t(e) => e.cardId === CardIds.MasterOfRealities_BG21_036 || e.cardId === CardIds.MasterOfRealities_BG21_036_G,\r\n\t\t);\r\n\t\tmasterOfRealities.forEach((master) => {\r\n\t\t\tconst baseBuff = 2;\r\n\t\t\tconst mult = master.cardId === CardIds.MasterOfRealities_BG21_036_G ? 2 : 1;\r\n\t\t\tmodifyStats(master, master, baseBuff * mult, baseBuff * mult, friendlyBoard, friendlyBoardHero, gameState);\r\n\t\t});\r\n\t}\r\n\tconst tentaclesOfCthun = friendlyBoard\r\n\t\t.filter((e) => e.entityId !== entity.entityId)\r\n\t\t.filter(\r\n\t\t\t(e) =>\r\n\t\t\t\te.cardId === CardIds.TentacleOfCthun_TB_BaconShop_HERO_29_Buddy ||\r\n\t\t\t\te.cardId === CardIds.TentacleOfCthun_TB_BaconShop_HERO_29_Buddy_G,\r\n\t\t);\r\n\ttentaclesOfCthun.forEach((tentacle) => {\r\n\t\ttentacle.attack += tentacle.cardId === CardIds.TentacleOfCthun_TB_BaconShop_HERO_29_Buddy_G ? 2 : 1;\r\n\t\ttentacle.health += tentacle.cardId === CardIds.TentacleOfCthun_TB_BaconShop_HERO_29_Buddy_G ? 2 : 1;\r\n\t});\r\n};\r\n\r\nexport interface OnStatsChangedInput {\r\n\ttarget: BoardEntity;\r\n\tattackAmount: number;\r\n\thealthAmount: number;\r\n\tboard: BoardEntity[];\r\n\thero: BgsPlayerEntity;\r\n\totherHero: BgsPlayerEntity;\r\n\tgameState: FullGameState;\r\n}\r\n"]}
|
|
@@ -150,6 +150,7 @@ const handleFrostwolfFervorForPlayer = (heroPower, playerBoard, playerEntity, op
|
|
|
150
150
|
const newMinions = (0, deathrattle_spawns_1.spawnEntities)(copy.cardId, 1, playerBoard, playerEntity, opponentBoard, opponentEntity, gameState, playerEntity.friendly, false, false, false, copy);
|
|
151
151
|
const spawns = (0, spawns_1.performEntitySpawns)(newMinions, playerBoard, playerEntity, playerEntity, indexFromRight, opponentBoard, opponentEntity, gameState);
|
|
152
152
|
gameState.spectator.registerPowerTarget(playerEntity, spawns[0], playerBoard, playerEntity, opponentEntity);
|
|
153
|
+
return true;
|
|
153
154
|
}
|
|
154
155
|
}
|
|
155
156
|
return false;
|
|
@@ -179,6 +180,7 @@ const handleStormpikeStrengthForPlayer = (heroPower, playerBoard, playerEntity,
|
|
|
179
180
|
const newMinions = (0, deathrattle_spawns_1.spawnEntities)(copy.cardId, 1, playerBoard, playerEntity, opponentBoard, opponentEntity, gameState, playerEntity.friendly, false, false, false, copy);
|
|
180
181
|
const spawns = (0, spawns_1.performEntitySpawns)(newMinions, playerBoard, playerEntity, playerEntity, indexFromRight, opponentBoard, opponentEntity, gameState);
|
|
181
182
|
gameState.spectator.registerPowerTarget(playerEntity, spawns[0], playerBoard, playerEntity, opponentEntity);
|
|
183
|
+
return true;
|
|
182
184
|
}
|
|
183
185
|
}
|
|
184
186
|
return false;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"summon-when-space.js","sourceRoot":"","sources":["../../src/simulation/summon-when-space.ts"],"names":[],"mappings":";;;AAAA,iEAAoD;AAGpD,6CAAgD;AAEhD,6CAAqF;AACrF,oCAA+E;AAC/E,+DAA4D;AAC5D,6DAAqD;AAErD,qCAA+C;AAExC,MAAM,sBAAsB,GAAG,CACrC,WAA0B,EAC1B,YAA6B,EAC7B,aAA4B,EAC5B,cAA+B,EAC/B,SAAwB,EACd,EAAE;IACZ,IAAI,8BAA8B,GAAG,KAAK,CAAC;IAC3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,EACX,YAAY,EACZ,YAAY,EACZ,cAAc,EACd,aAAa,EACb,cAAc,EACd,SAAS,EACT,UAAU,CACV,CAAC;IACF,SAAS,CAAC,SAAS,CAAC,mBAAmB,CAAC,YAAY,EAAE,SAAS,EAAE,WAAW,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;IAC1F,OAAO,OAAO,CAAC;AAChB,CAAC,CAAC","sourcesContent":["import { Race } from '@firestone-hs/reference-data';\r\nimport { BgsHeroPower, BgsPlayerEntity, BoardTrinket } from '../bgs-player-entity';\r\nimport { BoardEntity } from '../board-entity';\r\nimport { updateTaunt } from '../keywords/taunt';\r\nimport { CardIds } from '../services/card-ids';\r\nimport { pickRandomHighestAttack, pickRandomHighestHealth } from '../services/utils';\r\nimport { buildSingleBoardEntity, copyEntity, hasCorrectTribe } from '../utils';\r\nimport { removeAurasFromSelf } from './add-minion-to-board';\r\nimport { spawnEntities } from './deathrattle-spawns';\r\nimport { FullGameState } from './internal-game-state';\r\nimport { performEntitySpawns } from './spawns';\r\n\r\nexport const handleSummonsWhenSpace = (\r\n\tplayerBoard: BoardEntity[],\r\n\tplayerEntity: BgsPlayerEntity,\r\n\topponentBoard: BoardEntity[],\r\n\topponentEntity: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n): boolean => {\r\n\tlet shouldRecomputeCurrentAttacker = false;\r\n\tif (Math.random() < 0.5) {\r\n\t\tshouldRecomputeCurrentAttacker =\r\n\t\t\thandleSummonsWhenSpaceForPlayer(\r\n\t\t\t\tplayerEntity,\r\n\t\t\t\tplayerBoard,\r\n\t\t\t\tplayerEntity,\r\n\t\t\t\topponentBoard,\r\n\t\t\t\topponentEntity,\r\n\t\t\t\tgameState,\r\n\t\t\t) || shouldRecomputeCurrentAttacker;\r\n\t\tshouldRecomputeCurrentAttacker =\r\n\t\t\thandleSummonsWhenSpaceForPlayer(\r\n\t\t\t\topponentEntity,\r\n\t\t\t\topponentBoard,\r\n\t\t\t\topponentEntity,\r\n\t\t\t\tplayerBoard,\r\n\t\t\t\tplayerEntity,\r\n\t\t\t\tgameState,\r\n\t\t\t) || shouldRecomputeCurrentAttacker;\r\n\t} else {\r\n\t\tshouldRecomputeCurrentAttacker = handleSummonsWhenSpaceForPlayer(\r\n\t\t\topponentEntity,\r\n\t\t\topponentBoard,\r\n\t\t\topponentEntity,\r\n\t\t\tplayerBoard,\r\n\t\t\tplayerEntity,\r\n\t\t\tgameState,\r\n\t\t);\r\n\t\tshouldRecomputeCurrentAttacker =\r\n\t\t\thandleSummonsWhenSpaceForPlayer(\r\n\t\t\t\tplayerEntity,\r\n\t\t\t\tplayerBoard,\r\n\t\t\t\tplayerEntity,\r\n\t\t\t\topponentBoard,\r\n\t\t\t\topponentEntity,\r\n\t\t\t\tgameState,\r\n\t\t\t) || shouldRecomputeCurrentAttacker;\r\n\t}\r\n\treturn shouldRecomputeCurrentAttacker;\r\n};\r\n\r\n// TODO: Twin Sky Lanterns wait for 2 spaces\r\nconst handleSummonsWhenSpaceForPlayer = (\r\n\ttargetEntity: BgsPlayerEntity,\r\n\tplayerBoard: BoardEntity[],\r\n\tplayerEntity: BgsPlayerEntity,\r\n\topponentBoard: BoardEntity[],\r\n\topponentEntity: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n): boolean => {\r\n\tlet shouldRecomputeCurrentAttacker = false;\r\n\tif (targetEntity.rapidReanimationMinion) {\r\n\t\tshouldRecomputeCurrentAttacker =\r\n\t\t\thandleRapidReanimationForPlayer(playerBoard, playerEntity, opponentBoard, opponentEntity, gameState) ||\r\n\t\t\tshouldRecomputeCurrentAttacker;\r\n\t}\r\n\tif (targetEntity.questRewards?.includes(CardIds.StableAmalgamation_BG28_Reward_518)) {\r\n\t\tshouldRecomputeCurrentAttacker =\r\n\t\t\thandleStableAmalgamationForPlayer(playerBoard, playerEntity, opponentBoard, opponentEntity, gameState) ||\r\n\t\t\tshouldRecomputeCurrentAttacker;\r\n\t}\r\n\tif (targetEntity.secrets?.some((s) => s.cardId === CardIds.BoonOfBeetles_BG28_603)) {\r\n\t\tshouldRecomputeCurrentAttacker =\r\n\t\t\thandleBoonOfBeetlesForPlayer(playerBoard, playerEntity, opponentBoard, opponentEntity, gameState) ||\r\n\t\t\tshouldRecomputeCurrentAttacker;\r\n\t}\r\n\tfor (const heroPower of targetEntity.heroPowers) {\r\n\t\tif (heroPower.cardId === CardIds.Ozumat_Tentacular && heroPower.ready) {\r\n\t\t\tshouldRecomputeCurrentAttacker =\r\n\t\t\t\thandleOzumatForPlayer(\r\n\t\t\t\t\theroPower,\r\n\t\t\t\t\tplayerBoard,\r\n\t\t\t\t\tplayerEntity,\r\n\t\t\t\t\topponentBoard,\r\n\t\t\t\t\topponentEntity,\r\n\t\t\t\t\ttargetEntity.friendly,\r\n\t\t\t\t\tgameState,\r\n\t\t\t\t) || shouldRecomputeCurrentAttacker;\r\n\t\t} else if (\r\n\t\t\theroPower.cardId === CardIds.Drekthar_LeadTheFrostwolves &&\r\n\t\t\tgameState.currentTurn >= 7 &&\r\n\t\t\t!heroPower.activated\r\n\t\t) {\r\n\t\t\tshouldRecomputeCurrentAttacker =\r\n\t\t\t\thandleFrostwolfFervorForPlayer(\r\n\t\t\t\t\theroPower,\r\n\t\t\t\t\tplayerBoard,\r\n\t\t\t\t\tplayerEntity,\r\n\t\t\t\t\topponentBoard,\r\n\t\t\t\t\topponentEntity,\r\n\t\t\t\t\ttargetEntity.friendly,\r\n\t\t\t\t\tgameState,\r\n\t\t\t\t) || shouldRecomputeCurrentAttacker;\r\n\t\t} else if (\r\n\t\t\theroPower.cardId === CardIds.VanndarStormpike_LeadTheStormpikes &&\r\n\t\t\tgameState.currentTurn >= 7 &&\r\n\t\t\t!heroPower.activated\r\n\t\t) {\r\n\t\t\tshouldRecomputeCurrentAttacker =\r\n\t\t\t\thandleStormpikeStrengthForPlayer(\r\n\t\t\t\t\theroPower,\r\n\t\t\t\t\tplayerBoard,\r\n\t\t\t\t\tplayerEntity,\r\n\t\t\t\t\topponentBoard,\r\n\t\t\t\t\topponentEntity,\r\n\t\t\t\t\ttargetEntity.friendly,\r\n\t\t\t\t\tgameState,\r\n\t\t\t\t) || shouldRecomputeCurrentAttacker;\r\n\t\t} else if (\r\n\t\t\theroPower.cardId === CardIds.LockAndLoadToken_BG22_HERO_000p_Alt &&\r\n\t\t\t!heroPower.activated &&\r\n\t\t\theroPower.ready\r\n\t\t) {\r\n\t\t\tshouldRecomputeCurrentAttacker =\r\n\t\t\t\t!!handleLockAndLoadForPlayer(\r\n\t\t\t\t\theroPower,\r\n\t\t\t\t\tplayerBoard,\r\n\t\t\t\t\tplayerEntity,\r\n\t\t\t\t\topponentBoard,\r\n\t\t\t\t\topponentEntity,\r\n\t\t\t\t\ttargetEntity.friendly,\r\n\t\t\t\t\tgameState,\r\n\t\t\t\t) || shouldRecomputeCurrentAttacker;\r\n\t\t}\r\n\t}\r\n\ttargetEntity.trinkets\r\n\t\t.filter(\r\n\t\t\t(t) =>\r\n\t\t\t\tt.cardId === CardIds.TwinSkyLanterns_BG30_MagicItem_822 ||\r\n\t\t\t\tt.cardId === CardIds.TwinSkyLanterns_TwinSkyLanternsToken_BG30_MagicItem_822t2,\r\n\t\t)\r\n\t\t.forEach((t) => {\r\n\t\t\thandleTwinSkyLanternsForPlayer(t, playerBoard, playerEntity, opponentBoard, opponentEntity, gameState);\r\n\t\t});\r\n\ttargetEntity.trinkets\r\n\t\t.filter((t) => t.cardId === CardIds.BoomController_BG30_MagicItem_440)\r\n\t\t.forEach((t) => {\r\n\t\t\thandleBoomControllerForPlayer(t, playerBoard, playerEntity, opponentBoard, opponentEntity, gameState);\r\n\t\t});\r\n\tplayerBoard\r\n\t\t.filter(\r\n\t\t\t(e) => e.cardId === CardIds.SharptoothSnapper_BG32_201 || e.cardId === CardIds.SharptoothSnapper_BG32_201_G,\r\n\t\t)\r\n\t\t.forEach((e) => {\r\n\t\t\thandleSharptoothSnapperForPlayer(e, playerBoard, playerEntity, opponentBoard, opponentEntity, gameState);\r\n\t\t});\r\n\treturn shouldRecomputeCurrentAttacker;\r\n};\r\n\r\nexport const handleSharptoothSnapperForPlayer = (\r\n\tentity: BoardEntity,\r\n\tplayerBoard: BoardEntity[],\r\n\tplayerEntity: BgsPlayerEntity,\r\n\topponentBoard: BoardEntity[],\r\n\topponentEntity: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\twhile (playerBoard.length < 7 && entity.abiityChargesLeft > 0) {\r\n\t\tconst candidates = spawnEntities(\r\n\t\t\tCardIds.SharptoothSnapper_PiranhaToken_BG32_201t,\r\n\t\t\t1,\r\n\t\t\tplayerBoard,\r\n\t\t\tplayerEntity,\r\n\t\t\topponentBoard,\r\n\t\t\topponentEntity,\r\n\t\t\tgameState,\r\n\t\t\tplayerEntity.friendly,\r\n\t\t\ttrue,\r\n\t\t);\r\n\t\tcandidates.forEach((t) => (t.attackImmediately = true));\r\n\t\tconst actualSpawns = performEntitySpawns(\r\n\t\t\tcandidates,\r\n\t\t\tplayerBoard,\r\n\t\t\tplayerEntity,\r\n\t\t\tplayerEntity,\r\n\t\t\tplayerBoard.length - 1 - playerBoard.indexOf(entity),\r\n\t\t\topponentBoard,\r\n\t\t\topponentEntity,\r\n\t\t\tgameState,\r\n\t\t);\r\n\t\tentity.abiityChargesLeft--;\r\n\t}\r\n};\r\n\r\nconst handleBoomControllerForPlayer = (\r\n\ttrinket: BoardTrinket,\r\n\tplayerBoard: BoardEntity[],\r\n\tplayerEntity: BgsPlayerEntity,\r\n\topponentBoard: BoardEntity[],\r\n\topponentEntity: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\tif (playerBoard.length < 7 && trinket.scriptDataNum1 > 0) {\r\n\t\tconst candidate = gameState.sharedState.deaths\r\n\t\t\t.filter((d) => d.friendly === playerEntity.friendly)\r\n\t\t\t.filter((d) => hasCorrectTribe(d, playerEntity, Race.MECH, gameState.anomalies, gameState.allCards))[0];\r\n\t\tif (!!candidate) {\r\n\t\t\tconst spawn = copyEntity(candidate);\r\n\t\t\tremoveAurasFromSelf(spawn, playerBoard, playerEntity, gameState);\r\n\t\t\tconst initialIndexFromLeft = candidate.indexFromLeftAtTimeOfDeath;\r\n\t\t\tconst indexFromRight =\r\n\t\t\t\tinitialIndexFromLeft == null\r\n\t\t\t\t\t? 0\r\n\t\t\t\t\t: Math.min(playerBoard.length, Math.max(0, playerBoard.length - initialIndexFromLeft));\r\n\t\t\tconst target = spawnEntities(\r\n\t\t\t\tspawn.cardId,\r\n\t\t\t\t1,\r\n\t\t\t\tplayerBoard,\r\n\t\t\t\tplayerEntity,\r\n\t\t\t\topponentBoard,\r\n\t\t\t\topponentEntity,\r\n\t\t\t\tgameState,\r\n\t\t\t\tplayerEntity.friendly,\r\n\t\t\t\ttrue,\r\n\t\t\t\tfalse,\r\n\t\t\t\tfalse,\r\n\t\t\t\tspawn,\r\n\t\t\t);\r\n\t\t\t// FIXME: here it should try to match the position at which the original minions died\r\n\t\t\tconst actualSpawns = performEntitySpawns(\r\n\t\t\t\ttarget,\r\n\t\t\t\tplayerBoard,\r\n\t\t\t\tplayerEntity,\r\n\t\t\t\tplayerEntity,\r\n\t\t\t\tindexFromRight,\r\n\t\t\t\topponentBoard,\r\n\t\t\t\topponentEntity,\r\n\t\t\t\tgameState,\r\n\t\t\t);\r\n\t\t\tactualSpawns.forEach((t) =>\r\n\t\t\t\tgameState.spectator.registerPowerTarget(playerEntity, t, playerBoard, playerEntity, opponentEntity),\r\n\t\t\t);\r\n\t\t\ttrinket.scriptDataNum1 = 0;\r\n\t\t\t// It summons an exact copy\r\n\t\t\t// actualSpawns.forEach((entity) => {\r\n\t\t\t// \tswitch (entity.cardId) {\r\n\t\t\t// \t\tcase CardIds.AstralAutomaton_BG_TTN_401:\r\n\t\t\t// \t\tcase CardIds.AstralAutomaton_BG_TTN_401_G:\r\n\t\t\t// \t\t\tconst overstatMult = entity.cardId === CardIds.AstralAutomaton_BG_TTN_401 ? 1 : 2;\r\n\t\t\t// \t\t\tentity.attack = Math.max(1, entity.attack - 2 * overstatMult);\r\n\t\t\t// \t\t\tentity.health = Math.max(0, entity.health - overstatMult);\r\n\t\t\t// \t\t\tbreak;\r\n\t\t\t// \t}\r\n\t\t\t// });\r\n\t\t}\r\n\t}\r\n};\r\n\r\nconst handleTwinSkyLanternsForPlayer = (\r\n\ttrinket: BoardTrinket,\r\n\tplayerBoard: BoardEntity[],\r\n\tplayerEntity: BgsPlayerEntity,\r\n\topponentBoard: BoardEntity[],\r\n\topponentEntity: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\tconst spawnNumber = trinket.scriptDataNum1 ?? 0;\r\n\tconst canTrigger = spawnNumber >= 1;\r\n\tif (playerBoard.length <= 7 - spawnNumber && trinket.rememberedMinion && canTrigger) {\r\n\t\ttrinket.scriptDataNum1 = 0;\r\n\t\tconst spawn = copyEntity(trinket.rememberedMinion);\r\n\t\tremoveAurasFromSelf(spawn, playerBoard, playerEntity, gameState);\r\n\t\tconst target = spawnEntities(\r\n\t\t\tspawn.cardId,\r\n\t\t\tspawnNumber,\r\n\t\t\tplayerBoard,\r\n\t\t\tplayerEntity,\r\n\t\t\topponentBoard,\r\n\t\t\topponentEntity,\r\n\t\t\tgameState,\r\n\t\t\tplayerEntity.friendly,\r\n\t\t\ttrue,\r\n\t\t\tfalse,\r\n\t\t\tfalse,\r\n\t\t\tspawn,\r\n\t\t);\r\n\t\tperformEntitySpawns(\r\n\t\t\ttarget,\r\n\t\t\tplayerBoard,\r\n\t\t\tplayerEntity,\r\n\t\t\tplayerEntity,\r\n\t\t\t0,\r\n\t\t\topponentBoard,\r\n\t\t\topponentEntity,\r\n\t\t\tgameState,\r\n\t\t);\r\n\t\ttarget.forEach((t) =>\r\n\t\t\tgameState.spectator.registerPowerTarget(playerEntity, t, playerBoard, playerEntity, opponentEntity),\r\n\t\t);\r\n\t}\r\n};\r\n\r\nconst handleOzumatForPlayer = (\r\n\theroPower: BgsHeroPower,\r\n\tplayerBoard: BoardEntity[],\r\n\tplayerEntity: BgsPlayerEntity,\r\n\topponentBoard: BoardEntity[],\r\n\topponentEntity: BgsPlayerEntity,\r\n\tfriendly: boolean,\r\n\tgameState: FullGameState,\r\n) => {\r\n\tif (playerBoard.length < 7 && heroPower.activated === false) {\r\n\t\tconst tentacularSize = +heroPower.info;\r\n\t\tconst tentacular = spawnEntities(\r\n\t\t\tCardIds.Tentacular_OzumatsTentacleToken_BG23_HERO_201pt,\r\n\t\t\t1,\r\n\t\t\tplayerBoard,\r\n\t\t\tplayerEntity,\r\n\t\t\topponentBoard,\r\n\t\t\topponentEntity,\r\n\t\t\tgameState,\r\n\t\t\tfriendly,\r\n\t\t\ttrue,\r\n\t\t\tfalse,\r\n\t\t\tfalse,\r\n\t\t);\r\n\t\ttentacular[0].attack = tentacularSize;\r\n\t\ttentacular[0].health = tentacularSize;\r\n\t\ttentacular[0].maxHealth = tentacularSize;\r\n\t\ttentacular[0].maxAttack = tentacularSize;\r\n\t\tconst indexFromRight = 0;\r\n\t\tperformEntitySpawns(\r\n\t\t\ttentacular,\r\n\t\t\tplayerBoard,\r\n\t\t\tplayerEntity,\r\n\t\t\tplayerEntity,\r\n\t\t\tindexFromRight,\r\n\t\t\topponentBoard,\r\n\t\t\topponentEntity,\r\n\t\t\tgameState,\r\n\t\t);\r\n\t\tgameState.spectator.registerPowerTarget(playerEntity, tentacular[0], playerBoard, playerEntity, opponentEntity);\r\n\t\theroPower.activated = true;\r\n\t}\r\n\treturn true;\r\n};\r\n\r\nconst handleFrostwolfFervorForPlayer = (\r\n\theroPower: BgsHeroPower,\r\n\tplayerBoard: BoardEntity[],\r\n\tplayerEntity: BgsPlayerEntity,\r\n\topponentBoard: BoardEntity[],\r\n\topponentEntity: BgsPlayerEntity,\r\n\tfriendly: boolean,\r\n\tgameState: FullGameState,\r\n) => {\r\n\tif (playerBoard.length < 7) {\r\n\t\theroPower.activated = true;\r\n\t\tconst target = pickRandomHighestAttack(playerBoard);\r\n\t\tif (!!target) {\r\n\t\t\tconst copy = copyEntity(target);\r\n\t\t\tconst indexFromRight = playerBoard.length - (playerBoard.indexOf(target) + 1);\r\n\t\t\tconst newMinions = spawnEntities(\r\n\t\t\t\tcopy.cardId,\r\n\t\t\t\t1,\r\n\t\t\t\tplayerBoard,\r\n\t\t\t\tplayerEntity,\r\n\t\t\t\topponentBoard,\r\n\t\t\t\topponentEntity,\r\n\t\t\t\tgameState,\r\n\t\t\t\tplayerEntity.friendly,\r\n\t\t\t\tfalse,\r\n\t\t\t\tfalse,\r\n\t\t\t\tfalse,\r\n\t\t\t\tcopy,\r\n\t\t\t);\r\n\t\t\tconst spawns = performEntitySpawns(\r\n\t\t\t\tnewMinions,\r\n\t\t\t\tplayerBoard,\r\n\t\t\t\tplayerEntity,\r\n\t\t\t\tplayerEntity,\r\n\t\t\t\tindexFromRight,\r\n\t\t\t\topponentBoard,\r\n\t\t\t\topponentEntity,\r\n\t\t\t\tgameState,\r\n\t\t\t);\r\n\t\t\tgameState.spectator.registerPowerTarget(playerEntity, spawns[0], playerBoard, playerEntity, opponentEntity);\r\n\t\t}\r\n\t}\r\n\treturn false;\r\n};\r\n\r\nconst handleLockAndLoadForPlayer = (\r\n\theroPower: BgsHeroPower,\r\n\tplayerBoard: BoardEntity[],\r\n\tplayerEntity: BgsPlayerEntity,\r\n\topponentBoard: BoardEntity[],\r\n\topponentEntity: BgsPlayerEntity,\r\n\tfriendly: boolean,\r\n\tgameState: FullGameState,\r\n) => {\r\n\tif (playerBoard.length < 7) {\r\n\t\tconst summoned = heroPower.info as BoardEntity;\r\n\t\theroPower.activated = true;\r\n\t\tif (!!summoned?.cardId) {\r\n\t\t\tconst copy = copyEntity(summoned);\r\n\t\t\tcopy.attackImmediately = true;\r\n\t\t\tconst indexFromRight = 0;\r\n\t\t\tconst newMinions = spawnEntities(\r\n\t\t\t\tcopy.cardId,\r\n\t\t\t\t1,\r\n\t\t\t\tplayerBoard,\r\n\t\t\t\tplayerEntity,\r\n\t\t\t\topponentBoard,\r\n\t\t\t\topponentEntity,\r\n\t\t\t\tgameState,\r\n\t\t\t\tplayerEntity.friendly,\r\n\t\t\t\tfalse,\r\n\t\t\t\tfalse,\r\n\t\t\t\tfalse,\r\n\t\t\t\tcopy,\r\n\t\t\t);\r\n\t\t\tconst spawns = performEntitySpawns(\r\n\t\t\t\tnewMinions,\r\n\t\t\t\tplayerBoard,\r\n\t\t\t\tplayerEntity,\r\n\t\t\t\tplayerEntity,\r\n\t\t\t\tindexFromRight,\r\n\t\t\t\topponentBoard,\r\n\t\t\t\topponentEntity,\r\n\t\t\t\tgameState,\r\n\t\t\t);\r\n\t\t\tgameState.spectator.registerPowerTarget(playerEntity, spawns[0], playerBoard, playerEntity, opponentEntity);\r\n\t\t\t// Do the attack right now, so that we can recompute the first attacker once the attack resolves\r\n\t\t\t// Attack is actually performed with the \"performEntitySpawns\" function\r\n\t\t\t// simulateAttack(playerBoard, playerEntity, opponentBoard, opponentEntity, gameState);\r\n\t\t\t// 33.6 https://replays.firestoneapp.com/?reviewId=441da83c-3e40-4630-b98f-caf1932e5be7&turn=11&action=0\r\n\t\t\treturn true;\r\n\t\t}\r\n\t}\r\n};\r\n\r\nconst handleStormpikeStrengthForPlayer = (\r\n\theroPower: BgsHeroPower,\r\n\tplayerBoard: BoardEntity[],\r\n\tplayerEntity: BgsPlayerEntity,\r\n\topponentBoard: BoardEntity[],\r\n\topponentEntity: BgsPlayerEntity,\r\n\tfriendly: boolean,\r\n\tgameState: FullGameState,\r\n) => {\r\n\tif (playerBoard.length < 7) {\r\n\t\theroPower.activated = true;\r\n\t\tconst target = pickRandomHighestHealth(playerBoard);\r\n\t\tif (!!target) {\r\n\t\t\tconst copy = copyEntity(target);\r\n\t\t\tconst indexFromRight = playerBoard.length - (playerBoard.indexOf(target) + 1);\r\n\t\t\tconst newMinions = spawnEntities(\r\n\t\t\t\tcopy.cardId,\r\n\t\t\t\t1,\r\n\t\t\t\tplayerBoard,\r\n\t\t\t\tplayerEntity,\r\n\t\t\t\topponentBoard,\r\n\t\t\t\topponentEntity,\r\n\t\t\t\tgameState,\r\n\t\t\t\tplayerEntity.friendly,\r\n\t\t\t\tfalse,\r\n\t\t\t\tfalse,\r\n\t\t\t\tfalse,\r\n\t\t\t\tcopy,\r\n\t\t\t);\r\n\t\t\tconst spawns = performEntitySpawns(\r\n\t\t\t\tnewMinions,\r\n\t\t\t\tplayerBoard,\r\n\t\t\t\tplayerEntity,\r\n\t\t\t\tplayerEntity,\r\n\t\t\t\tindexFromRight,\r\n\t\t\t\topponentBoard,\r\n\t\t\t\topponentEntity,\r\n\t\t\t\tgameState,\r\n\t\t\t);\r\n\t\t\tgameState.spectator.registerPowerTarget(playerEntity, spawns[0], playerBoard, playerEntity, opponentEntity);\r\n\t\t}\r\n\t}\r\n\treturn false;\r\n};\r\n\r\nconst handleBoonOfBeetlesForPlayer = (\r\n\tplayerBoard: BoardEntity[],\r\n\tplayerEntity: BgsPlayerEntity,\r\n\topponentBoard: BoardEntity[],\r\n\topponentEntity: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n) => {\r\n\tconst secretEntity = playerEntity.secrets.find((entity) => entity.cardId === CardIds.BoonOfBeetles_BG28_603);\r\n\tif (secretEntity && secretEntity.triggersLeft > 0) {\r\n\t\twhile (secretEntity.triggersLeft > 0) {\r\n\t\t\tconst hasSummoned = handleSummon(\r\n\t\t\t\tplayerBoard,\r\n\t\t\t\tplayerEntity,\r\n\t\t\t\topponentBoard,\r\n\t\t\t\topponentEntity,\r\n\t\t\t\tgameState,\r\n\t\t\t\tCardIds.BoonOfBeetles_BeetleToken_BG28_603t,\r\n\t\t\t\t0,\r\n\t\t\t\ttrue,\r\n\t\t\t);\r\n\t\t\tif (hasSummoned) {\r\n\t\t\t\thasSummoned.forEach((entity) => {\r\n\t\t\t\t\tupdateTaunt(entity, true, playerBoard, playerEntity, opponentEntity, gameState);\r\n\t\t\t\t});\r\n\t\t\t\tsecretEntity.triggersLeft--;\r\n\t\t\t} else {\r\n\t\t\t\t// No room to summon, we stop here\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn false;\r\n};\r\nconst handleStableAmalgamationForPlayer = (\r\n\tplayerBoard: BoardEntity[],\r\n\tplayerEntity: BgsPlayerEntity,\r\n\topponentBoard: BoardEntity[],\r\n\topponentEntity: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n) => {\r\n\tconst rewardEntity = playerEntity.questRewardEntities.find(\r\n\t\t(entity) => entity.cardId === CardIds.StableAmalgamation_BG28_Reward_518,\r\n\t);\r\n\tif (rewardEntity && rewardEntity.scriptDataNum1 > 0) {\r\n\t\twhile (rewardEntity.scriptDataNum1 > 0) {\r\n\t\t\tconst hasSummoned = handleSummon(\r\n\t\t\t\tplayerBoard,\r\n\t\t\t\tplayerEntity,\r\n\t\t\t\topponentBoard,\r\n\t\t\t\topponentEntity,\r\n\t\t\t\tgameState,\r\n\t\t\t\tCardIds.StableAmalgamation_TotallyNormalHorseToken_BG28_Reward_518t,\r\n\t\t\t\t0,\r\n\t\t\t\ttrue,\r\n\t\t\t);\r\n\t\t\tif (hasSummoned) {\r\n\t\t\t\trewardEntity.scriptDataNum1--;\r\n\t\t\t} else {\r\n\t\t\t\t// No room to summon, we stop here\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn false;\r\n};\r\n\r\nconst handleRapidReanimationForPlayer = (\r\n\tplayerBoard: BoardEntity[],\r\n\tplayerEntity: BgsPlayerEntity,\r\n\topponentBoard: BoardEntity[],\r\n\topponentEntity: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n) => {\r\n\tconst indexFromRight =\r\n\t\tplayerEntity.rapidReanimationIndexFromLeft === 0\r\n\t\t\t? Math.max(0, playerBoard.length - playerEntity.rapidReanimationIndexFromLeft)\r\n\t\t\t: playerEntity.rapidReanimationIndexFromRight;\r\n\tconst hasSummoned = handleSummon(\r\n\t\tplayerBoard,\r\n\t\tplayerEntity,\r\n\t\topponentBoard,\r\n\t\topponentEntity,\r\n\t\tgameState,\r\n\t\tplayerEntity.rapidReanimationMinion.cardId,\r\n\t\tindexFromRight,\r\n\t\ttrue, // (Goldrinn gets buffed, so it seems we reapply auras? This is a mess tbh)\r\n\t\tplayerEntity.rapidReanimationMinion,\r\n\t);\r\n\tif (hasSummoned) {\r\n\t\tplayerEntity.rapidReanimationMinion = null;\r\n\t\t// Hard-coding a correction for Ancestral Automaton\r\n\t\t// Shold not be necessary if we reapply auras\r\n\t\t// hasSummoned.forEach((entity) => {\r\n\t\t// \tswitch (entity.cardId) {\r\n\t\t// \t\tcase CardIds.AstralAutomaton_BG_TTN_401:\r\n\t\t// \t\tcase CardIds.AstralAutomaton_BG_TTN_401_G:\r\n\t\t// \t\t\tconst overstatMult = entity.cardId === CardIds.AstralAutomaton_BG_TTN_401 ? 1 : 2;\r\n\t\t// \t\t\tentity.attack = Math.max(1, entity.attack + 2 * overstatMult);\r\n\t\t// \t\t\tentity.health = Math.max(0, entity.health + 2 * overstatMult);\r\n\t\t// \t\t\tbreak;\r\n\t\t// \t\tcase CardIds.EternalKnight_BG25_008:\r\n\t\t// \t\tcase CardIds.EternalKnight_BG25_008_G:\r\n\t\t// \t\t\tconst knightMult = entity.cardId === CardIds.EternalKnight_BG25_008 ? 1 : 2;\r\n\t\t// \t\t\tentity.attack = Math.max(1, entity.attack + 1 * knightMult);\r\n\t\t// \t\t\tentity.health = Math.max(0, entity.health + 1 * knightMult);\r\n\t\t// \t\t\tbreak;\r\n\t\t// \t}\r\n\t\t// });\r\n\t}\r\n\treturn false;\r\n};\r\n\r\nconst handleSummon = (\r\n\tplayerBoard: BoardEntity[],\r\n\tplayerEntity: BgsPlayerEntity,\r\n\topponentBoard: BoardEntity[],\r\n\topponentEntity: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n\tcardId: string,\r\n\tindexFromRight: number,\r\n\tapplyAuras: boolean,\r\n\tminion: BoardEntity = null,\r\n): readonly BoardEntity[] => {\r\n\tif (playerBoard.length >= 7) {\r\n\t\treturn null;\r\n\t}\r\n\tconst newMinion = buildSingleBoardEntity(\r\n\t\tcardId,\r\n\t\tplayerEntity,\r\n\t\tplayerBoard,\r\n\t\tgameState.allCards,\r\n\t\tplayerEntity.friendly,\r\n\t\tgameState.sharedState.currentEntityId++,\r\n\t\tfalse,\r\n\t\tgameState.cardsData,\r\n\t\tgameState.sharedState,\r\n\t\tminion,\r\n\t\tnull,\r\n\t);\r\n\t// Don't reapply auras in this particular case? See https://x.com/ZerotoHeroes_HS/status/1737422727118487808?s=20\r\n\tconst spawned = performEntitySpawns(\r\n\t\t[newMinion],\r\n\t\tplayerBoard,\r\n\t\tplayerEntity,\r\n\t\tplayerEntity,\r\n\t\tindexFromRight,\r\n\t\topponentBoard,\r\n\t\topponentEntity,\r\n\t\tgameState,\r\n\t\tapplyAuras,\r\n\t);\r\n\tgameState.spectator.registerPowerTarget(playerEntity, newMinion, playerBoard, null, null);\r\n\treturn spawned;\r\n};\r\n"]}
|
|
1
|
+
{"version":3,"file":"summon-when-space.js","sourceRoot":"","sources":["../../src/simulation/summon-when-space.ts"],"names":[],"mappings":";;;AAAA,iEAAoD;AAGpD,6CAAgD;AAEhD,6CAAqF;AACrF,oCAA+E;AAC/E,+DAA4D;AAC5D,6DAAqD;AAErD,qCAA+C;AAExC,MAAM,sBAAsB,GAAG,CACrC,WAA0B,EAC1B,YAA6B,EAC7B,aAA4B,EAC5B,cAA+B,EAC/B,SAAwB,EACd,EAAE;IACZ,IAAI,8BAA8B,GAAG,KAAK,CAAC;IAC3C,IAAI,IAAI,CAAC,MAAM,EAAE,GAAG,GAAG,EAAE;QACxB,8BAA8B;YAC7B,+BAA+B,CAC9B,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,aAAa,EACb,cAAc,EACd,SAAS,CACT,IAAI,8BAA8B,CAAC;QACrC,8BAA8B;YAC7B,+BAA+B,CAC9B,cAAc,EACd,aAAa,EACb,cAAc,EACd,WAAW,EACX,YAAY,EACZ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CAAC;AAChB,CAAC,CAAC","sourcesContent":["import { Race } from '@firestone-hs/reference-data';\r\nimport { BgsHeroPower, BgsPlayerEntity, BoardTrinket } from '../bgs-player-entity';\r\nimport { BoardEntity } from '../board-entity';\r\nimport { updateTaunt } from '../keywords/taunt';\r\nimport { CardIds } from '../services/card-ids';\r\nimport { pickRandomHighestAttack, pickRandomHighestHealth } from '../services/utils';\r\nimport { buildSingleBoardEntity, copyEntity, hasCorrectTribe } from '../utils';\r\nimport { removeAurasFromSelf } from './add-minion-to-board';\r\nimport { spawnEntities } from './deathrattle-spawns';\r\nimport { FullGameState } from './internal-game-state';\r\nimport { performEntitySpawns } from './spawns';\r\n\r\nexport const handleSummonsWhenSpace = (\r\n\tplayerBoard: BoardEntity[],\r\n\tplayerEntity: BgsPlayerEntity,\r\n\topponentBoard: BoardEntity[],\r\n\topponentEntity: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n): boolean => {\r\n\tlet shouldRecomputeCurrentAttacker = false;\r\n\tif (Math.random() < 0.5) {\r\n\t\tshouldRecomputeCurrentAttacker =\r\n\t\t\thandleSummonsWhenSpaceForPlayer(\r\n\t\t\t\tplayerEntity,\r\n\t\t\t\tplayerBoard,\r\n\t\t\t\tplayerEntity,\r\n\t\t\t\topponentBoard,\r\n\t\t\t\topponentEntity,\r\n\t\t\t\tgameState,\r\n\t\t\t) || shouldRecomputeCurrentAttacker;\r\n\t\tshouldRecomputeCurrentAttacker =\r\n\t\t\thandleSummonsWhenSpaceForPlayer(\r\n\t\t\t\topponentEntity,\r\n\t\t\t\topponentBoard,\r\n\t\t\t\topponentEntity,\r\n\t\t\t\tplayerBoard,\r\n\t\t\t\tplayerEntity,\r\n\t\t\t\tgameState,\r\n\t\t\t) || shouldRecomputeCurrentAttacker;\r\n\t} else {\r\n\t\tshouldRecomputeCurrentAttacker = handleSummonsWhenSpaceForPlayer(\r\n\t\t\topponentEntity,\r\n\t\t\topponentBoard,\r\n\t\t\topponentEntity,\r\n\t\t\tplayerBoard,\r\n\t\t\tplayerEntity,\r\n\t\t\tgameState,\r\n\t\t);\r\n\t\tshouldRecomputeCurrentAttacker =\r\n\t\t\thandleSummonsWhenSpaceForPlayer(\r\n\t\t\t\tplayerEntity,\r\n\t\t\t\tplayerBoard,\r\n\t\t\t\tplayerEntity,\r\n\t\t\t\topponentBoard,\r\n\t\t\t\topponentEntity,\r\n\t\t\t\tgameState,\r\n\t\t\t) || shouldRecomputeCurrentAttacker;\r\n\t}\r\n\treturn shouldRecomputeCurrentAttacker;\r\n};\r\n\r\n// TODO: Twin Sky Lanterns wait for 2 spaces\r\nconst handleSummonsWhenSpaceForPlayer = (\r\n\ttargetEntity: BgsPlayerEntity,\r\n\tplayerBoard: BoardEntity[],\r\n\tplayerEntity: BgsPlayerEntity,\r\n\topponentBoard: BoardEntity[],\r\n\topponentEntity: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n): boolean => {\r\n\tlet shouldRecomputeCurrentAttacker = false;\r\n\tif (targetEntity.rapidReanimationMinion) {\r\n\t\tshouldRecomputeCurrentAttacker =\r\n\t\t\thandleRapidReanimationForPlayer(playerBoard, playerEntity, opponentBoard, opponentEntity, gameState) ||\r\n\t\t\tshouldRecomputeCurrentAttacker;\r\n\t}\r\n\tif (targetEntity.questRewards?.includes(CardIds.StableAmalgamation_BG28_Reward_518)) {\r\n\t\tshouldRecomputeCurrentAttacker =\r\n\t\t\thandleStableAmalgamationForPlayer(playerBoard, playerEntity, opponentBoard, opponentEntity, gameState) ||\r\n\t\t\tshouldRecomputeCurrentAttacker;\r\n\t}\r\n\tif (targetEntity.secrets?.some((s) => s.cardId === CardIds.BoonOfBeetles_BG28_603)) {\r\n\t\tshouldRecomputeCurrentAttacker =\r\n\t\t\thandleBoonOfBeetlesForPlayer(playerBoard, playerEntity, opponentBoard, opponentEntity, gameState) ||\r\n\t\t\tshouldRecomputeCurrentAttacker;\r\n\t}\r\n\tfor (const heroPower of targetEntity.heroPowers) {\r\n\t\tif (heroPower.cardId === CardIds.Ozumat_Tentacular && heroPower.ready) {\r\n\t\t\tshouldRecomputeCurrentAttacker =\r\n\t\t\t\thandleOzumatForPlayer(\r\n\t\t\t\t\theroPower,\r\n\t\t\t\t\tplayerBoard,\r\n\t\t\t\t\tplayerEntity,\r\n\t\t\t\t\topponentBoard,\r\n\t\t\t\t\topponentEntity,\r\n\t\t\t\t\ttargetEntity.friendly,\r\n\t\t\t\t\tgameState,\r\n\t\t\t\t) || shouldRecomputeCurrentAttacker;\r\n\t\t} else if (\r\n\t\t\theroPower.cardId === CardIds.Drekthar_LeadTheFrostwolves &&\r\n\t\t\tgameState.currentTurn >= 7 &&\r\n\t\t\t!heroPower.activated\r\n\t\t) {\r\n\t\t\tshouldRecomputeCurrentAttacker =\r\n\t\t\t\thandleFrostwolfFervorForPlayer(\r\n\t\t\t\t\theroPower,\r\n\t\t\t\t\tplayerBoard,\r\n\t\t\t\t\tplayerEntity,\r\n\t\t\t\t\topponentBoard,\r\n\t\t\t\t\topponentEntity,\r\n\t\t\t\t\ttargetEntity.friendly,\r\n\t\t\t\t\tgameState,\r\n\t\t\t\t) || shouldRecomputeCurrentAttacker;\r\n\t\t} else if (\r\n\t\t\theroPower.cardId === CardIds.VanndarStormpike_LeadTheStormpikes &&\r\n\t\t\tgameState.currentTurn >= 7 &&\r\n\t\t\t!heroPower.activated\r\n\t\t) {\r\n\t\t\tshouldRecomputeCurrentAttacker =\r\n\t\t\t\thandleStormpikeStrengthForPlayer(\r\n\t\t\t\t\theroPower,\r\n\t\t\t\t\tplayerBoard,\r\n\t\t\t\t\tplayerEntity,\r\n\t\t\t\t\topponentBoard,\r\n\t\t\t\t\topponentEntity,\r\n\t\t\t\t\ttargetEntity.friendly,\r\n\t\t\t\t\tgameState,\r\n\t\t\t\t) || shouldRecomputeCurrentAttacker;\r\n\t\t} else if (\r\n\t\t\theroPower.cardId === CardIds.LockAndLoadToken_BG22_HERO_000p_Alt &&\r\n\t\t\t!heroPower.activated &&\r\n\t\t\theroPower.ready\r\n\t\t) {\r\n\t\t\tshouldRecomputeCurrentAttacker =\r\n\t\t\t\t!!handleLockAndLoadForPlayer(\r\n\t\t\t\t\theroPower,\r\n\t\t\t\t\tplayerBoard,\r\n\t\t\t\t\tplayerEntity,\r\n\t\t\t\t\topponentBoard,\r\n\t\t\t\t\topponentEntity,\r\n\t\t\t\t\ttargetEntity.friendly,\r\n\t\t\t\t\tgameState,\r\n\t\t\t\t) || shouldRecomputeCurrentAttacker;\r\n\t\t}\r\n\t}\r\n\ttargetEntity.trinkets\r\n\t\t.filter(\r\n\t\t\t(t) =>\r\n\t\t\t\tt.cardId === CardIds.TwinSkyLanterns_BG30_MagicItem_822 ||\r\n\t\t\t\tt.cardId === CardIds.TwinSkyLanterns_TwinSkyLanternsToken_BG30_MagicItem_822t2,\r\n\t\t)\r\n\t\t.forEach((t) => {\r\n\t\t\thandleTwinSkyLanternsForPlayer(t, playerBoard, playerEntity, opponentBoard, opponentEntity, gameState);\r\n\t\t});\r\n\ttargetEntity.trinkets\r\n\t\t.filter((t) => t.cardId === CardIds.BoomController_BG30_MagicItem_440)\r\n\t\t.forEach((t) => {\r\n\t\t\thandleBoomControllerForPlayer(t, playerBoard, playerEntity, opponentBoard, opponentEntity, gameState);\r\n\t\t});\r\n\tplayerBoard\r\n\t\t.filter(\r\n\t\t\t(e) => e.cardId === CardIds.SharptoothSnapper_BG32_201 || e.cardId === CardIds.SharptoothSnapper_BG32_201_G,\r\n\t\t)\r\n\t\t.forEach((e) => {\r\n\t\t\thandleSharptoothSnapperForPlayer(e, playerBoard, playerEntity, opponentBoard, opponentEntity, gameState);\r\n\t\t});\r\n\treturn shouldRecomputeCurrentAttacker;\r\n};\r\n\r\nexport const handleSharptoothSnapperForPlayer = (\r\n\tentity: BoardEntity,\r\n\tplayerBoard: BoardEntity[],\r\n\tplayerEntity: BgsPlayerEntity,\r\n\topponentBoard: BoardEntity[],\r\n\topponentEntity: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\twhile (playerBoard.length < 7 && entity.abiityChargesLeft > 0) {\r\n\t\tconst candidates = spawnEntities(\r\n\t\t\tCardIds.SharptoothSnapper_PiranhaToken_BG32_201t,\r\n\t\t\t1,\r\n\t\t\tplayerBoard,\r\n\t\t\tplayerEntity,\r\n\t\t\topponentBoard,\r\n\t\t\topponentEntity,\r\n\t\t\tgameState,\r\n\t\t\tplayerEntity.friendly,\r\n\t\t\ttrue,\r\n\t\t);\r\n\t\tcandidates.forEach((t) => (t.attackImmediately = true));\r\n\t\tconst actualSpawns = performEntitySpawns(\r\n\t\t\tcandidates,\r\n\t\t\tplayerBoard,\r\n\t\t\tplayerEntity,\r\n\t\t\tplayerEntity,\r\n\t\t\tplayerBoard.length - 1 - playerBoard.indexOf(entity),\r\n\t\t\topponentBoard,\r\n\t\t\topponentEntity,\r\n\t\t\tgameState,\r\n\t\t);\r\n\t\tentity.abiityChargesLeft--;\r\n\t}\r\n};\r\n\r\nconst handleBoomControllerForPlayer = (\r\n\ttrinket: BoardTrinket,\r\n\tplayerBoard: BoardEntity[],\r\n\tplayerEntity: BgsPlayerEntity,\r\n\topponentBoard: BoardEntity[],\r\n\topponentEntity: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\tif (playerBoard.length < 7 && trinket.scriptDataNum1 > 0) {\r\n\t\tconst candidate = gameState.sharedState.deaths\r\n\t\t\t.filter((d) => d.friendly === playerEntity.friendly)\r\n\t\t\t.filter((d) => hasCorrectTribe(d, playerEntity, Race.MECH, gameState.anomalies, gameState.allCards))[0];\r\n\t\tif (!!candidate) {\r\n\t\t\tconst spawn = copyEntity(candidate);\r\n\t\t\tremoveAurasFromSelf(spawn, playerBoard, playerEntity, gameState);\r\n\t\t\tconst initialIndexFromLeft = candidate.indexFromLeftAtTimeOfDeath;\r\n\t\t\tconst indexFromRight =\r\n\t\t\t\tinitialIndexFromLeft == null\r\n\t\t\t\t\t? 0\r\n\t\t\t\t\t: Math.min(playerBoard.length, Math.max(0, playerBoard.length - initialIndexFromLeft));\r\n\t\t\tconst target = spawnEntities(\r\n\t\t\t\tspawn.cardId,\r\n\t\t\t\t1,\r\n\t\t\t\tplayerBoard,\r\n\t\t\t\tplayerEntity,\r\n\t\t\t\topponentBoard,\r\n\t\t\t\topponentEntity,\r\n\t\t\t\tgameState,\r\n\t\t\t\tplayerEntity.friendly,\r\n\t\t\t\ttrue,\r\n\t\t\t\tfalse,\r\n\t\t\t\tfalse,\r\n\t\t\t\tspawn,\r\n\t\t\t);\r\n\t\t\t// FIXME: here it should try to match the position at which the original minions died\r\n\t\t\tconst actualSpawns = performEntitySpawns(\r\n\t\t\t\ttarget,\r\n\t\t\t\tplayerBoard,\r\n\t\t\t\tplayerEntity,\r\n\t\t\t\tplayerEntity,\r\n\t\t\t\tindexFromRight,\r\n\t\t\t\topponentBoard,\r\n\t\t\t\topponentEntity,\r\n\t\t\t\tgameState,\r\n\t\t\t);\r\n\t\t\tactualSpawns.forEach((t) =>\r\n\t\t\t\tgameState.spectator.registerPowerTarget(playerEntity, t, playerBoard, playerEntity, opponentEntity),\r\n\t\t\t);\r\n\t\t\ttrinket.scriptDataNum1 = 0;\r\n\t\t\t// It summons an exact copy\r\n\t\t\t// actualSpawns.forEach((entity) => {\r\n\t\t\t// \tswitch (entity.cardId) {\r\n\t\t\t// \t\tcase CardIds.AstralAutomaton_BG_TTN_401:\r\n\t\t\t// \t\tcase CardIds.AstralAutomaton_BG_TTN_401_G:\r\n\t\t\t// \t\t\tconst overstatMult = entity.cardId === CardIds.AstralAutomaton_BG_TTN_401 ? 1 : 2;\r\n\t\t\t// \t\t\tentity.attack = Math.max(1, entity.attack - 2 * overstatMult);\r\n\t\t\t// \t\t\tentity.health = Math.max(0, entity.health - overstatMult);\r\n\t\t\t// \t\t\tbreak;\r\n\t\t\t// \t}\r\n\t\t\t// });\r\n\t\t}\r\n\t}\r\n};\r\n\r\nconst handleTwinSkyLanternsForPlayer = (\r\n\ttrinket: BoardTrinket,\r\n\tplayerBoard: BoardEntity[],\r\n\tplayerEntity: BgsPlayerEntity,\r\n\topponentBoard: BoardEntity[],\r\n\topponentEntity: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\tconst spawnNumber = trinket.scriptDataNum1 ?? 0;\r\n\tconst canTrigger = spawnNumber >= 1;\r\n\tif (playerBoard.length <= 7 - spawnNumber && trinket.rememberedMinion && canTrigger) {\r\n\t\ttrinket.scriptDataNum1 = 0;\r\n\t\tconst spawn = copyEntity(trinket.rememberedMinion);\r\n\t\tremoveAurasFromSelf(spawn, playerBoard, playerEntity, gameState);\r\n\t\tconst target = spawnEntities(\r\n\t\t\tspawn.cardId,\r\n\t\t\tspawnNumber,\r\n\t\t\tplayerBoard,\r\n\t\t\tplayerEntity,\r\n\t\t\topponentBoard,\r\n\t\t\topponentEntity,\r\n\t\t\tgameState,\r\n\t\t\tplayerEntity.friendly,\r\n\t\t\ttrue,\r\n\t\t\tfalse,\r\n\t\t\tfalse,\r\n\t\t\tspawn,\r\n\t\t);\r\n\t\tperformEntitySpawns(\r\n\t\t\ttarget,\r\n\t\t\tplayerBoard,\r\n\t\t\tplayerEntity,\r\n\t\t\tplayerEntity,\r\n\t\t\t0,\r\n\t\t\topponentBoard,\r\n\t\t\topponentEntity,\r\n\t\t\tgameState,\r\n\t\t);\r\n\t\ttarget.forEach((t) =>\r\n\t\t\tgameState.spectator.registerPowerTarget(playerEntity, t, playerBoard, playerEntity, opponentEntity),\r\n\t\t);\r\n\t}\r\n};\r\n\r\nconst handleOzumatForPlayer = (\r\n\theroPower: BgsHeroPower,\r\n\tplayerBoard: BoardEntity[],\r\n\tplayerEntity: BgsPlayerEntity,\r\n\topponentBoard: BoardEntity[],\r\n\topponentEntity: BgsPlayerEntity,\r\n\tfriendly: boolean,\r\n\tgameState: FullGameState,\r\n) => {\r\n\tif (playerBoard.length < 7 && heroPower.activated === false) {\r\n\t\tconst tentacularSize = +heroPower.info;\r\n\t\tconst tentacular = spawnEntities(\r\n\t\t\tCardIds.Tentacular_OzumatsTentacleToken_BG23_HERO_201pt,\r\n\t\t\t1,\r\n\t\t\tplayerBoard,\r\n\t\t\tplayerEntity,\r\n\t\t\topponentBoard,\r\n\t\t\topponentEntity,\r\n\t\t\tgameState,\r\n\t\t\tfriendly,\r\n\t\t\ttrue,\r\n\t\t\tfalse,\r\n\t\t\tfalse,\r\n\t\t);\r\n\t\ttentacular[0].attack = tentacularSize;\r\n\t\ttentacular[0].health = tentacularSize;\r\n\t\ttentacular[0].maxHealth = tentacularSize;\r\n\t\ttentacular[0].maxAttack = tentacularSize;\r\n\t\tconst indexFromRight = 0;\r\n\t\tperformEntitySpawns(\r\n\t\t\ttentacular,\r\n\t\t\tplayerBoard,\r\n\t\t\tplayerEntity,\r\n\t\t\tplayerEntity,\r\n\t\t\tindexFromRight,\r\n\t\t\topponentBoard,\r\n\t\t\topponentEntity,\r\n\t\t\tgameState,\r\n\t\t);\r\n\t\tgameState.spectator.registerPowerTarget(playerEntity, tentacular[0], playerBoard, playerEntity, opponentEntity);\r\n\t\theroPower.activated = true;\r\n\t}\r\n\treturn true;\r\n};\r\n\r\nconst handleFrostwolfFervorForPlayer = (\r\n\theroPower: BgsHeroPower,\r\n\tplayerBoard: BoardEntity[],\r\n\tplayerEntity: BgsPlayerEntity,\r\n\topponentBoard: BoardEntity[],\r\n\topponentEntity: BgsPlayerEntity,\r\n\tfriendly: boolean,\r\n\tgameState: FullGameState,\r\n) => {\r\n\tif (playerBoard.length < 7) {\r\n\t\theroPower.activated = true;\r\n\t\tconst target = pickRandomHighestAttack(playerBoard);\r\n\t\tif (!!target) {\r\n\t\t\tconst copy = copyEntity(target);\r\n\t\t\tconst indexFromRight = playerBoard.length - (playerBoard.indexOf(target) + 1);\r\n\t\t\tconst newMinions = spawnEntities(\r\n\t\t\t\tcopy.cardId,\r\n\t\t\t\t1,\r\n\t\t\t\tplayerBoard,\r\n\t\t\t\tplayerEntity,\r\n\t\t\t\topponentBoard,\r\n\t\t\t\topponentEntity,\r\n\t\t\t\tgameState,\r\n\t\t\t\tplayerEntity.friendly,\r\n\t\t\t\tfalse,\r\n\t\t\t\tfalse,\r\n\t\t\t\tfalse,\r\n\t\t\t\tcopy,\r\n\t\t\t);\r\n\t\t\tconst spawns = performEntitySpawns(\r\n\t\t\t\tnewMinions,\r\n\t\t\t\tplayerBoard,\r\n\t\t\t\tplayerEntity,\r\n\t\t\t\tplayerEntity,\r\n\t\t\t\tindexFromRight,\r\n\t\t\t\topponentBoard,\r\n\t\t\t\topponentEntity,\r\n\t\t\t\tgameState,\r\n\t\t\t);\r\n\t\t\tgameState.spectator.registerPowerTarget(playerEntity, spawns[0], playerBoard, playerEntity, opponentEntity);\r\n\t\t\t// 33.6.2 https://replays.firestoneapp.com/?reviewId=35bc0472-b915-4fa3-8d29-8a8d4d806745&turn=15&action=2\r\n\t\t\treturn true;\r\n\t\t}\r\n\t}\r\n\treturn false;\r\n};\r\n\r\nconst handleLockAndLoadForPlayer = (\r\n\theroPower: BgsHeroPower,\r\n\tplayerBoard: BoardEntity[],\r\n\tplayerEntity: BgsPlayerEntity,\r\n\topponentBoard: BoardEntity[],\r\n\topponentEntity: BgsPlayerEntity,\r\n\tfriendly: boolean,\r\n\tgameState: FullGameState,\r\n) => {\r\n\tif (playerBoard.length < 7) {\r\n\t\tconst summoned = heroPower.info as BoardEntity;\r\n\t\theroPower.activated = true;\r\n\t\tif (!!summoned?.cardId) {\r\n\t\t\tconst copy = copyEntity(summoned);\r\n\t\t\tcopy.attackImmediately = true;\r\n\t\t\tconst indexFromRight = 0;\r\n\t\t\tconst newMinions = spawnEntities(\r\n\t\t\t\tcopy.cardId,\r\n\t\t\t\t1,\r\n\t\t\t\tplayerBoard,\r\n\t\t\t\tplayerEntity,\r\n\t\t\t\topponentBoard,\r\n\t\t\t\topponentEntity,\r\n\t\t\t\tgameState,\r\n\t\t\t\tplayerEntity.friendly,\r\n\t\t\t\tfalse,\r\n\t\t\t\tfalse,\r\n\t\t\t\tfalse,\r\n\t\t\t\tcopy,\r\n\t\t\t);\r\n\t\t\tconst spawns = performEntitySpawns(\r\n\t\t\t\tnewMinions,\r\n\t\t\t\tplayerBoard,\r\n\t\t\t\tplayerEntity,\r\n\t\t\t\tplayerEntity,\r\n\t\t\t\tindexFromRight,\r\n\t\t\t\topponentBoard,\r\n\t\t\t\topponentEntity,\r\n\t\t\t\tgameState,\r\n\t\t\t);\r\n\t\t\tgameState.spectator.registerPowerTarget(playerEntity, spawns[0], playerBoard, playerEntity, opponentEntity);\r\n\t\t\t// Do the attack right now, so that we can recompute the first attacker once the attack resolves\r\n\t\t\t// Attack is actually performed with the \"performEntitySpawns\" function\r\n\t\t\t// simulateAttack(playerBoard, playerEntity, opponentBoard, opponentEntity, gameState);\r\n\t\t\t// 33.6 https://replays.firestoneapp.com/?reviewId=441da83c-3e40-4630-b98f-caf1932e5be7&turn=11&action=0\r\n\t\t\treturn true;\r\n\t\t}\r\n\t}\r\n};\r\n\r\nconst handleStormpikeStrengthForPlayer = (\r\n\theroPower: BgsHeroPower,\r\n\tplayerBoard: BoardEntity[],\r\n\tplayerEntity: BgsPlayerEntity,\r\n\topponentBoard: BoardEntity[],\r\n\topponentEntity: BgsPlayerEntity,\r\n\tfriendly: boolean,\r\n\tgameState: FullGameState,\r\n) => {\r\n\tif (playerBoard.length < 7) {\r\n\t\theroPower.activated = true;\r\n\t\tconst target = pickRandomHighestHealth(playerBoard);\r\n\t\tif (!!target) {\r\n\t\t\tconst copy = copyEntity(target);\r\n\t\t\tconst indexFromRight = playerBoard.length - (playerBoard.indexOf(target) + 1);\r\n\t\t\tconst newMinions = spawnEntities(\r\n\t\t\t\tcopy.cardId,\r\n\t\t\t\t1,\r\n\t\t\t\tplayerBoard,\r\n\t\t\t\tplayerEntity,\r\n\t\t\t\topponentBoard,\r\n\t\t\t\topponentEntity,\r\n\t\t\t\tgameState,\r\n\t\t\t\tplayerEntity.friendly,\r\n\t\t\t\tfalse,\r\n\t\t\t\tfalse,\r\n\t\t\t\tfalse,\r\n\t\t\t\tcopy,\r\n\t\t\t);\r\n\t\t\tconst spawns = performEntitySpawns(\r\n\t\t\t\tnewMinions,\r\n\t\t\t\tplayerBoard,\r\n\t\t\t\tplayerEntity,\r\n\t\t\t\tplayerEntity,\r\n\t\t\t\tindexFromRight,\r\n\t\t\t\topponentBoard,\r\n\t\t\t\topponentEntity,\r\n\t\t\t\tgameState,\r\n\t\t\t);\r\n\t\t\tgameState.spectator.registerPowerTarget(playerEntity, spawns[0], playerBoard, playerEntity, opponentEntity);\r\n\t\t\t// 33.6.2 https://replays.firestoneapp.com/?reviewId=35bc0472-b915-4fa3-8d29-8a8d4d806745&turn=15&action=2\r\n\t\t\treturn true;\r\n\t\t}\r\n\t}\r\n\treturn false;\r\n};\r\n\r\nconst handleBoonOfBeetlesForPlayer = (\r\n\tplayerBoard: BoardEntity[],\r\n\tplayerEntity: BgsPlayerEntity,\r\n\topponentBoard: BoardEntity[],\r\n\topponentEntity: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n) => {\r\n\tconst secretEntity = playerEntity.secrets.find((entity) => entity.cardId === CardIds.BoonOfBeetles_BG28_603);\r\n\tif (secretEntity && secretEntity.triggersLeft > 0) {\r\n\t\twhile (secretEntity.triggersLeft > 0) {\r\n\t\t\tconst hasSummoned = handleSummon(\r\n\t\t\t\tplayerBoard,\r\n\t\t\t\tplayerEntity,\r\n\t\t\t\topponentBoard,\r\n\t\t\t\topponentEntity,\r\n\t\t\t\tgameState,\r\n\t\t\t\tCardIds.BoonOfBeetles_BeetleToken_BG28_603t,\r\n\t\t\t\t0,\r\n\t\t\t\ttrue,\r\n\t\t\t);\r\n\t\t\tif (hasSummoned) {\r\n\t\t\t\thasSummoned.forEach((entity) => {\r\n\t\t\t\t\tupdateTaunt(entity, true, playerBoard, playerEntity, opponentEntity, gameState);\r\n\t\t\t\t});\r\n\t\t\t\tsecretEntity.triggersLeft--;\r\n\t\t\t} else {\r\n\t\t\t\t// No room to summon, we stop here\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn false;\r\n};\r\nconst handleStableAmalgamationForPlayer = (\r\n\tplayerBoard: BoardEntity[],\r\n\tplayerEntity: BgsPlayerEntity,\r\n\topponentBoard: BoardEntity[],\r\n\topponentEntity: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n) => {\r\n\tconst rewardEntity = playerEntity.questRewardEntities.find(\r\n\t\t(entity) => entity.cardId === CardIds.StableAmalgamation_BG28_Reward_518,\r\n\t);\r\n\tif (rewardEntity && rewardEntity.scriptDataNum1 > 0) {\r\n\t\twhile (rewardEntity.scriptDataNum1 > 0) {\r\n\t\t\tconst hasSummoned = handleSummon(\r\n\t\t\t\tplayerBoard,\r\n\t\t\t\tplayerEntity,\r\n\t\t\t\topponentBoard,\r\n\t\t\t\topponentEntity,\r\n\t\t\t\tgameState,\r\n\t\t\t\tCardIds.StableAmalgamation_TotallyNormalHorseToken_BG28_Reward_518t,\r\n\t\t\t\t0,\r\n\t\t\t\ttrue,\r\n\t\t\t);\r\n\t\t\tif (hasSummoned) {\r\n\t\t\t\trewardEntity.scriptDataNum1--;\r\n\t\t\t} else {\r\n\t\t\t\t// No room to summon, we stop here\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn false;\r\n};\r\n\r\nconst handleRapidReanimationForPlayer = (\r\n\tplayerBoard: BoardEntity[],\r\n\tplayerEntity: BgsPlayerEntity,\r\n\topponentBoard: BoardEntity[],\r\n\topponentEntity: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n) => {\r\n\tconst indexFromRight =\r\n\t\tplayerEntity.rapidReanimationIndexFromLeft === 0\r\n\t\t\t? Math.max(0, playerBoard.length - playerEntity.rapidReanimationIndexFromLeft)\r\n\t\t\t: playerEntity.rapidReanimationIndexFromRight;\r\n\tconst hasSummoned = handleSummon(\r\n\t\tplayerBoard,\r\n\t\tplayerEntity,\r\n\t\topponentBoard,\r\n\t\topponentEntity,\r\n\t\tgameState,\r\n\t\tplayerEntity.rapidReanimationMinion.cardId,\r\n\t\tindexFromRight,\r\n\t\ttrue, // (Goldrinn gets buffed, so it seems we reapply auras? This is a mess tbh)\r\n\t\tplayerEntity.rapidReanimationMinion,\r\n\t);\r\n\tif (hasSummoned) {\r\n\t\tplayerEntity.rapidReanimationMinion = null;\r\n\t\t// Hard-coding a correction for Ancestral Automaton\r\n\t\t// Shold not be necessary if we reapply auras\r\n\t\t// hasSummoned.forEach((entity) => {\r\n\t\t// \tswitch (entity.cardId) {\r\n\t\t// \t\tcase CardIds.AstralAutomaton_BG_TTN_401:\r\n\t\t// \t\tcase CardIds.AstralAutomaton_BG_TTN_401_G:\r\n\t\t// \t\t\tconst overstatMult = entity.cardId === CardIds.AstralAutomaton_BG_TTN_401 ? 1 : 2;\r\n\t\t// \t\t\tentity.attack = Math.max(1, entity.attack + 2 * overstatMult);\r\n\t\t// \t\t\tentity.health = Math.max(0, entity.health + 2 * overstatMult);\r\n\t\t// \t\t\tbreak;\r\n\t\t// \t\tcase CardIds.EternalKnight_BG25_008:\r\n\t\t// \t\tcase CardIds.EternalKnight_BG25_008_G:\r\n\t\t// \t\t\tconst knightMult = entity.cardId === CardIds.EternalKnight_BG25_008 ? 1 : 2;\r\n\t\t// \t\t\tentity.attack = Math.max(1, entity.attack + 1 * knightMult);\r\n\t\t// \t\t\tentity.health = Math.max(0, entity.health + 1 * knightMult);\r\n\t\t// \t\t\tbreak;\r\n\t\t// \t}\r\n\t\t// });\r\n\t}\r\n\treturn false;\r\n};\r\n\r\nconst handleSummon = (\r\n\tplayerBoard: BoardEntity[],\r\n\tplayerEntity: BgsPlayerEntity,\r\n\topponentBoard: BoardEntity[],\r\n\topponentEntity: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n\tcardId: string,\r\n\tindexFromRight: number,\r\n\tapplyAuras: boolean,\r\n\tminion: BoardEntity = null,\r\n): readonly BoardEntity[] => {\r\n\tif (playerBoard.length >= 7) {\r\n\t\treturn null;\r\n\t}\r\n\tconst newMinion = buildSingleBoardEntity(\r\n\t\tcardId,\r\n\t\tplayerEntity,\r\n\t\tplayerBoard,\r\n\t\tgameState.allCards,\r\n\t\tplayerEntity.friendly,\r\n\t\tgameState.sharedState.currentEntityId++,\r\n\t\tfalse,\r\n\t\tgameState.cardsData,\r\n\t\tgameState.sharedState,\r\n\t\tminion,\r\n\t\tnull,\r\n\t);\r\n\t// Don't reapply auras in this particular case? See https://x.com/ZerotoHeroes_HS/status/1737422727118487808?s=20\r\n\tconst spawned = performEntitySpawns(\r\n\t\t[newMinion],\r\n\t\tplayerBoard,\r\n\t\tplayerEntity,\r\n\t\tplayerEntity,\r\n\t\tindexFromRight,\r\n\t\topponentBoard,\r\n\t\topponentEntity,\r\n\t\tgameState,\r\n\t\tapplyAuras,\r\n\t);\r\n\tgameState.spectator.registerPowerTarget(playerEntity, newMinion, playerBoard, null, null);\r\n\treturn spawned;\r\n};\r\n"]}
|
package/dist/utils.js
CHANGED
|
@@ -287,14 +287,20 @@ const hasCorrectTribe = (entity, playerEntity, targetTribe, anomalies, allCards)
|
|
|
287
287
|
};
|
|
288
288
|
exports.hasCorrectTribe = hasCorrectTribe;
|
|
289
289
|
const getEffectiveTribesForEntity = (entity, playerEntity, anomalies, allCards) => {
|
|
290
|
-
var _a, _b;
|
|
291
|
-
|
|
290
|
+
var _a, _b, _c, _d;
|
|
291
|
+
const cardId = (_a = entity === null || entity === void 0 ? void 0 : entity.originalCardId) !== null && _a !== void 0 ? _a : entity === null || entity === void 0 ? void 0 : entity.cardId;
|
|
292
|
+
if (!cardId) {
|
|
292
293
|
return [];
|
|
293
294
|
}
|
|
294
|
-
const
|
|
295
|
+
const refCard = allCards.getCard(cardId);
|
|
296
|
+
const nativeTribes = (_c = (_b = refCard.races) === null || _b === void 0 ? void 0 : _b.map((r) => reference_data_1.Race[r])) !== null && _c !== void 0 ? _c : [];
|
|
295
297
|
if (!nativeTribes.length && (anomalies === null || anomalies === void 0 ? void 0 : anomalies.includes("BG31_Anomaly_112"))) {
|
|
296
298
|
return [reference_data_1.Race.ALL];
|
|
297
299
|
}
|
|
300
|
+
if (((_d = refCard.mechanics) === null || _d === void 0 ? void 0 : _d.includes(reference_data_1.GameTag[reference_data_1.GameTag.BACON_BUDDY])) &&
|
|
301
|
+
(anomalies === null || anomalies === void 0 ? void 0 : anomalies.includes("BG33_Anomaly_005"))) {
|
|
302
|
+
return [reference_data_1.Race.ALL];
|
|
303
|
+
}
|
|
298
304
|
return [...nativeTribes, ...getSpecialTribesForEntity(entity, playerEntity, allCards)];
|
|
299
305
|
};
|
|
300
306
|
exports.getEffectiveTribesForEntity = getEffectiveTribesForEntity;
|