@firestone-hs/simulate-bgs-battle 1.1.586 → 1.1.588
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 +3 -0
- package/dist/board-entity.js.map +1 -1
- package/dist/cards/impl/minion/anubarak-nerubian-king.js +1 -1
- package/dist/cards/impl/minion/anubarak-nerubian-king.js.map +1 -1
- package/dist/cards/impl/minion/champion-of-the-primus.js +1 -1
- package/dist/cards/impl/minion/champion-of-the-primus.js.map +1 -1
- package/dist/cards/impl/minion/interrogator-whitemane.js +1 -3
- package/dist/cards/impl/minion/interrogator-whitemane.js.map +1 -1
- package/dist/cards/impl/minion/nerubian-deathswarmer.js +1 -1
- package/dist/cards/impl/minion/nerubian-deathswarmer.js.map +1 -1
- package/dist/cards/impl/trinket/battle-horn.js +2 -2
- package/dist/cards/impl/trinket/battle-horn.js.map +1 -1
- package/dist/cards/impl/trinket/beetle-band.js +2 -3
- package/dist/cards/impl/trinket/beetle-band.js.map +1 -1
- package/dist/cards/impl/trinket/eclectic-shrine.js +1 -1
- package/dist/cards/impl/trinket/eclectic-shrine.js.map +1 -1
- package/dist/simulation/after-attack.d.ts +1 -0
- package/dist/simulation/after-attack.js +30 -26
- package/dist/simulation/after-attack.js.map +1 -1
- package/dist/simulation/attack.js +2 -1
- package/dist/simulation/attack.js.map +1 -1
- package/dist/simulation/avenge.d.ts +1 -1
- package/dist/simulation/avenge.js +1 -0
- package/dist/simulation/avenge.js.map +1 -1
- package/dist/simulation/deathrattle-effects.js +2 -0
- package/dist/simulation/deathrattle-effects.js.map +1 -1
- package/dist/simulation/deathrattle-orchestration.js +34 -19
- package/dist/simulation/deathrattle-orchestration.js.map +1 -1
- package/dist/simulation/deathrattle-spawns.js +5 -2
- package/dist/simulation/deathrattle-spawns.js.map +1 -1
- package/dist/simulation/spawns.js +2 -0
- package/dist/simulation/spawns.js.map +1 -1
- package/dist/simulation/stats.js +1 -0
- 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/simulation/utils/golden.js +2 -2
- package/dist/simulation/utils/golden.js.map +1 -1
- package/dist/utils.d.ts +1 -1
- package/dist/utils.js +8 -2
- package/dist/utils.js.map +1 -1
- package/package.json +1 -1
|
@@ -5,6 +5,7 @@ const add_minion_to_board_1 = require("./add-minion-to-board");
|
|
|
5
5
|
const attack_1 = require("./attack");
|
|
6
6
|
const spawn_fail_1 = require("./spawn-fail");
|
|
7
7
|
const performEntitySpawns = (candidateEntities, boardWithKilledMinion, boardWithKilledMinionHero, spawnSourceEntity, spawnSourceEntityIndexFromRight, opponentBoard, opponentBoardHero, gameState, applySelfAuras = true) => {
|
|
8
|
+
var _a;
|
|
8
9
|
const aliveEntites = candidateEntities.filter((entity) => entity.health > 0 && !entity.definitelyDead);
|
|
9
10
|
const spawnedEntities = [];
|
|
10
11
|
for (let i = 0; i < aliveEntites.length; i++) {
|
|
@@ -15,6 +16,7 @@ const performEntitySpawns = (candidateEntities, boardWithKilledMinion, boardWith
|
|
|
15
16
|
}
|
|
16
17
|
break;
|
|
17
18
|
}
|
|
19
|
+
spawnSourceEntityIndexFromRight = (_a = newMinion.spawnIndexFromRight) !== null && _a !== void 0 ? _a : spawnSourceEntityIndexFromRight;
|
|
18
20
|
const indexToSpawnAt = Math.max(0, boardWithKilledMinion.length - spawnSourceEntityIndexFromRight);
|
|
19
21
|
(0, add_minion_to_board_1.addMinionToBoard)(boardWithKilledMinion, boardWithKilledMinionHero, opponentBoard, opponentBoardHero, indexToSpawnAt, newMinion, gameState, true, applySelfAuras);
|
|
20
22
|
if (newMinion.attackImmediately) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spawns.js","sourceRoot":"","sources":["../../src/simulation/spawns.ts"],"names":[],"mappings":";;;AAEA,+DAAyD;AACzD,qCAA0C;AAE1C,6CAAqD;AAE9C,MAAM,mBAAmB,GAAG,C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AA+B,CAAC,CAAC;QACnG,IAAA,sCAAgB,EACf,qBAAqB,EACrB,yBAAyB,EACzB,aAAa,EACb,iBAAiB,EACjB,cAAc,EACd,SAAS,EACT,SAAS,EACT,IAAI,EACJ,cAAc,CACd,CAAC;QACF,IAAI,SAAS,CAAC,iBAAiB,EAAE;YAQhC,MAAM,cAAc,GAAG,IAAA,uBAAc,EACpC,qBAAqB,EACrB,yBAAyB,EACzB,aAAa,EACb,iBAAiB,EACjB,SAAS,CACT,CAAC;YAWF,IAAI,cAAc,EAAE;gBACnB,cAAc,CAAC,iBAAiB,GAAG,KAAK,CAAC;aACzC;iBAEI;gBACJ,SAAS,CAAC,iBAAiB,GAAG,KAAK,CAAC;aACpC;SACD;QACD,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,cAAc,EAAE;YACtD,eAAe,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;SAChC;KACD;IAED,SAAS,CAAC,SAAS,CAAC,oBAAoB,CAAC,iBAAiB,EAAE,qBAAqB,EAAE,eAAe,CAAC,CAAC;IACpG,OAAO,eAAe,CAAC;AACxB,CAAC,CAAC;AA/EW,QAAA,mBAAmB,uBA+E9B","sourcesContent":["import { BgsPlayerEntity, BoardTrinket } from '../bgs-player-entity';\r\nimport { BoardEntity } from '../board-entity';\r\nimport { addMinionToBoard } from './add-minion-to-board';\r\nimport { simulateAttack } from './attack';\r\nimport { FullGameState } from './internal-game-state';\r\nimport { onMinionFailedToSpawn } from './spawn-fail';\r\n\r\nexport const performEntitySpawns = (\r\n\tcandidateEntities: readonly BoardEntity[],\r\n\tboardWithKilledMinion: BoardEntity[],\r\n\tboardWithKilledMinionHero: BgsPlayerEntity,\r\n\tspawnSourceEntity: BoardEntity | BgsPlayerEntity | BoardTrinket,\r\n\tspawnSourceEntityIndexFromRight: number,\r\n\topponentBoard: BoardEntity[],\r\n\topponentBoardHero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n\tapplySelfAuras = true,\r\n): readonly BoardEntity[] => {\r\n\tconst aliveEntites = candidateEntities.filter((entity) => entity.health > 0 && !entity.definitelyDead);\r\n\tconst spawnedEntities = [];\r\n\tfor (let i = 0; i < aliveEntites.length; i++) {\r\n\t\tconst newMinion = aliveEntites[i];\r\n\t\t// All entities have been spawned\r\n\t\tif (boardWithKilledMinion.length >= 7) {\r\n\t\t\tfor (let j = i; j < aliveEntites.length; j++) {\r\n\t\t\t\tonMinionFailedToSpawn(aliveEntites[j], boardWithKilledMinion, boardWithKilledMinionHero, gameState);\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\t}\r\n\t\t// Avoid minions spawning backwards (we don't have this issue if we add all elements at\r\n\t\t// the same time, but here we want to be able to attack after each spawn, which in turn\r\n\t\t// means that the minion can die before the other one spawns)\r\n\t\t// In boardWithKilledMinion, the dead minion has already been removed\r\n\t\tspawnSourceEntityIndexFromRight = newMinion.spawnIndexFromRight ?? spawnSourceEntityIndexFromRight;\r\n\t\tconst indexToSpawnAt = Math.max(0, boardWithKilledMinion.length - spawnSourceEntityIndexFromRight);\r\n\t\taddMinionToBoard(\r\n\t\t\tboardWithKilledMinion,\r\n\t\t\tboardWithKilledMinionHero,\r\n\t\t\topponentBoard,\r\n\t\t\topponentBoardHero,\r\n\t\t\tindexToSpawnAt,\r\n\t\t\tnewMinion,\r\n\t\t\tgameState,\r\n\t\t\ttrue,\r\n\t\t\tapplySelfAuras,\r\n\t\t);\r\n\t\tif (newMinion.attackImmediately) {\r\n\t\t\t// console.debug(\r\n\t\t\t// \t'\\nattack immediately\\n',\r\n\t\t\t// \tstringifySimple(boardWithKilledMinion, gameState.allCards),\r\n\t\t\t// \t'\\n',\r\n\t\t\t// \tstringifySimple(opponentBoard, gameState.allCards),\r\n\t\t\t// );\r\n\t\t\t// Whenever we are already in a combat phase, we need to first clean up the state\r\n\t\t\tconst actualAttacker = simulateAttack(\r\n\t\t\t\tboardWithKilledMinion,\r\n\t\t\t\tboardWithKilledMinionHero,\r\n\t\t\t\topponentBoard,\r\n\t\t\t\topponentBoardHero,\r\n\t\t\t\tgameState,\r\n\t\t\t);\r\n\t\t\t// console.debug(\r\n\t\t\t// \t'after attack immediately\\n',\r\n\t\t\t// \tstringifySimple(boardWithKilledMinion, gameState.allCards),\r\n\t\t\t// \t'\\n',\r\n\t\t\t// \tstringifySimple(opponentBoard, gameState.allCards),\r\n\t\t\t// );\r\n\t\t\t// So that, even if the opponent's board is temporarily empty (e.g. no minion, but a token will\r\n\t\t\t// spawn in the enchantments resolution phase), the minion won't attack right away again\r\n\t\t\t// In case of attack immediately + multiple spawns minins, it's possible that the minion for which\r\n\t\t\t// we triggered the attack simulation was not the one who actually attacked\r\n\t\t\tif (actualAttacker) {\r\n\t\t\t\tactualAttacker.attackImmediately = false;\r\n\t\t\t}\r\n\t\t\t// Can happen if the attackImmediately minion spawns first, opponent board is empty, then opponent minino spawns\r\n\t\t\telse {\r\n\t\t\t\tnewMinion.attackImmediately = false;\r\n\t\t\t}\r\n\t\t}\r\n\t\tif (newMinion.health > 0 && !newMinion.definitelyDead) {\r\n\t\t\tspawnedEntities.push(newMinion);\r\n\t\t}\r\n\t}\r\n\r\n\tgameState.spectator.registerMinionsSpawn(spawnSourceEntity, boardWithKilledMinion, spawnedEntities);\r\n\treturn spawnedEntities;\r\n};\r\n"]}
|
package/dist/simulation/stats.js
CHANGED
|
@@ -92,6 +92,7 @@ const modifyStats = (entity, source, attackAmount, healthAmount, friendlyBoard,
|
|
|
92
92
|
gameState.spectator.registerPowerTarget(source, entity, friendlyBoard, friendlyBoardHero, otherBoardHero);
|
|
93
93
|
}
|
|
94
94
|
if (entity.cardId === "TB_BaconShop_HP_033t" ||
|
|
95
|
+
entity.cardId === "TB_BaconShop_HP_033t_G" ||
|
|
95
96
|
entity.cardId === "TB_BaconShop_HP_033t_SKIN_A" ||
|
|
96
97
|
entity.cardId === "TB_BaconShop_HP_033t_SKIN_A_G" ||
|
|
97
98
|
entity.cardId === "TB_BaconShop_H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C,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, 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 { 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\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.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: FullGameState;\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"stats.js","sourceRoot":"","sources":["../../src/simulation/st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,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, 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 { 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\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: FullGameState;\r\n}\r\n"]}
|
|
@@ -93,6 +93,8 @@ const handleOzumatForPlayer = (playerBoard, playerEntity, opponentBoard, opponen
|
|
|
93
93
|
const tentacular = (0, deathrattle_spawns_1.spawnEntities)("BG23_HERO_201pt", 1, playerBoard, playerEntity, opponentBoard, opponentEntity, gameState, friendly, true, false, false);
|
|
94
94
|
tentacular[0].attack = tentacularSize;
|
|
95
95
|
tentacular[0].health = tentacularSize;
|
|
96
|
+
tentacular[0].maxHealth = tentacularSize;
|
|
97
|
+
tentacular[0].maxAttack = tentacularSize;
|
|
96
98
|
const indexFromRight = 0;
|
|
97
99
|
(0, spawns_1.performEntitySpawns)(tentacular, playerBoard, playerEntity, playerEntity, indexFromRight, opponentBoard, opponentEntity, gameState);
|
|
98
100
|
gameState.spectator.registerPowerTarget(playerEntity, tentacular[0], playerBoard, playerEntity, opponentEntity);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"summon-when-space.js","sourceRoot":"","sources":["../../src/simulation/summon-when-space.ts"],"names":[],"mappings":";;;AAAA,iEAA6D;AAG7D,6CAAgD;AAChD,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,EACvB,EAAE;IACH,+BAA+B,CAAC,YAAY,EAAE,WAAW,EAAE,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,SAAS,CAAC,CAAC;IACnH,+BAA+B,CAC9B,cAAc,EACd,aAAa,EACb,cAAc,EACd,WAAW,EACX,YAAY,EACZ,SAAS,CACT,CAAC;AACH,CAAC,CAAC;AAhBW,QAAA,sBAAsB,0BAgBjC;AAGF,MAAM,+BAA+B,GAAG,CACvC,YAA6B,EAC7B,WAA0B,EAC1B,YAA6B,EAC7B,aAA4B,EAC5B,cAA+B,EAC/B,SAAwB,EACvB,EAAE;;IACH,IAAI,YAAY,CAAC,sBAAsB,EAAE;QACxC,+BAA+B,CAAC,WAAW,EAAE,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,SAAS,CAAC,CAAC;KAC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esContent":["import { CardIds, Race } from '@firestone-hs/reference-data';\r\nimport { BgsPlayerEntity, BoardTrinket } from '../bgs-player-entity';\r\nimport { BoardEntity } from '../board-entity';\r\nimport { updateTaunt } from '../keywords/taunt';\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) => {\r\n\thandleSummonsWhenSpaceForPlayer(playerEntity, playerBoard, playerEntity, opponentBoard, opponentEntity, gameState);\r\n\thandleSummonsWhenSpaceForPlayer(\r\n\t\topponentEntity,\r\n\t\topponentBoard,\r\n\t\topponentEntity,\r\n\t\tplayerBoard,\r\n\t\tplayerEntity,\r\n\t\tgameState,\r\n\t);\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) => {\r\n\tif (targetEntity.rapidReanimationMinion) {\r\n\t\thandleRapidReanimationForPlayer(playerBoard, playerEntity, opponentBoard, opponentEntity, gameState);\r\n\t}\r\n\tif (targetEntity.questRewards?.includes(CardIds.StableAmalgamation_BG28_Reward_518)) {\r\n\t\thandleStableAmalgamationForPlayer(playerBoard, playerEntity, opponentBoard, opponentEntity, gameState);\r\n\t}\r\n\tif (targetEntity.secrets?.some((s) => s.cardId === CardIds.BoonOfBeetles_BG28_603)) {\r\n\t\thandleBoonOfBeetlesForPlayer(playerBoard, playerEntity, opponentBoard, opponentEntity, gameState);\r\n\t}\r\n\tfor (const heroPower of targetEntity.heroPowers) {\r\n\t\tif (heroPower.cardId === CardIds.Ozumat_Tentacular) {\r\n\t\t\thandleOzumatForPlayer(\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\ttargetEntity.friendly,\r\n\t\t\t\tgameState,\r\n\t\t\t);\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};\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.scriptDataNum1 > 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.scriptDataNum1--;\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\tplayerBoard: BoardEntity[],\r\n\tplayerEntity: BgsPlayerEntity,\r\n\topponentBoard: BoardEntity[],\r\n\topponentEntity: BgsPlayerEntity,\r\n\tfriendly: boolean,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\tfor (const heroPower of playerEntity.heroPowers) {\r\n\t\tif (playerBoard.length < 7 && heroPower.activated === false) {\r\n\t\t\tconst tentacularSize = +heroPower.info;\r\n\t\t\tconst tentacular = spawnEntities(\r\n\t\t\t\tCardIds.Tentacular_OzumatsTentacleToken_BG23_HERO_201pt,\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\tfriendly,\r\n\t\t\t\ttrue,\r\n\t\t\t\tfalse,\r\n\t\t\t\tfalse,\r\n\t\t\t);\r\n\t\t\ttentacular[0].attack = tentacularSize;\r\n\t\t\ttentacular[0].health = tentacularSize;\r\n\t\t\tconst indexFromRight = 0;\r\n\t\t\tperformEntitySpawns(\r\n\t\t\t\ttentacular,\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(\r\n\t\t\t\tplayerEntity,\r\n\t\t\t\ttentacular[0],\r\n\t\t\t\tplayerBoard,\r\n\t\t\t\tplayerEntity,\r\n\t\t\t\topponentEntity,\r\n\t\t\t);\r\n\t\t\theroPower.activated = true;\r\n\t\t}\r\n\t}\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};\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};\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};\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,iEAA6D;AAG7D,6CAAgD;AAChD,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,EACvB,EAAE;IACH,+BAA+B,CAAC,YAAY,EAAE,WAAW,EAAE,YAAY,EAAE,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G,IAAA,8BAAsB,EACvC,MAAM,EACN,YAAY,EACZ,WAAW,EACX,SAAS,CAAC,QAAQ,EAClB,YAAY,CAAC,QAAQ,EACrB,SAAS,CAAC,WAAW,CAAC,eAAe,EAAE,EACvC,KAAK,EACL,SAAS,CAAC,SAAS,EACnB,SAAS,CAAC,WAAW,EACrB,MAAM,EACN,IAAI,CACJ,CAAC;IAEF,MAAM,OAAO,GAAG,IAAA,4BAAmB,EAClC,CAAC,SAAS,CAAC,EACX,WAAW,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 { CardIds, Race } from '@firestone-hs/reference-data';\r\nimport { BgsPlayerEntity, BoardTrinket } from '../bgs-player-entity';\r\nimport { BoardEntity } from '../board-entity';\r\nimport { updateTaunt } from '../keywords/taunt';\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) => {\r\n\thandleSummonsWhenSpaceForPlayer(playerEntity, playerBoard, playerEntity, opponentBoard, opponentEntity, gameState);\r\n\thandleSummonsWhenSpaceForPlayer(\r\n\t\topponentEntity,\r\n\t\topponentBoard,\r\n\t\topponentEntity,\r\n\t\tplayerBoard,\r\n\t\tplayerEntity,\r\n\t\tgameState,\r\n\t);\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) => {\r\n\tif (targetEntity.rapidReanimationMinion) {\r\n\t\thandleRapidReanimationForPlayer(playerBoard, playerEntity, opponentBoard, opponentEntity, gameState);\r\n\t}\r\n\tif (targetEntity.questRewards?.includes(CardIds.StableAmalgamation_BG28_Reward_518)) {\r\n\t\thandleStableAmalgamationForPlayer(playerBoard, playerEntity, opponentBoard, opponentEntity, gameState);\r\n\t}\r\n\tif (targetEntity.secrets?.some((s) => s.cardId === CardIds.BoonOfBeetles_BG28_603)) {\r\n\t\thandleBoonOfBeetlesForPlayer(playerBoard, playerEntity, opponentBoard, opponentEntity, gameState);\r\n\t}\r\n\tfor (const heroPower of targetEntity.heroPowers) {\r\n\t\tif (heroPower.cardId === CardIds.Ozumat_Tentacular) {\r\n\t\t\thandleOzumatForPlayer(\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\ttargetEntity.friendly,\r\n\t\t\t\tgameState,\r\n\t\t\t);\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};\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.scriptDataNum1 > 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.scriptDataNum1--;\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\tplayerBoard: BoardEntity[],\r\n\tplayerEntity: BgsPlayerEntity,\r\n\topponentBoard: BoardEntity[],\r\n\topponentEntity: BgsPlayerEntity,\r\n\tfriendly: boolean,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\tfor (const heroPower of playerEntity.heroPowers) {\r\n\t\tif (playerBoard.length < 7 && heroPower.activated === false) {\r\n\t\t\tconst tentacularSize = +heroPower.info;\r\n\t\t\tconst tentacular = spawnEntities(\r\n\t\t\t\tCardIds.Tentacular_OzumatsTentacleToken_BG23_HERO_201pt,\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\tfriendly,\r\n\t\t\t\ttrue,\r\n\t\t\t\tfalse,\r\n\t\t\t\tfalse,\r\n\t\t\t);\r\n\t\t\ttentacular[0].attack = tentacularSize;\r\n\t\t\ttentacular[0].health = tentacularSize;\r\n\t\t\ttentacular[0].maxHealth = tentacularSize;\r\n\t\t\ttentacular[0].maxAttack = tentacularSize;\r\n\t\t\tconst indexFromRight = 0;\r\n\t\t\tperformEntitySpawns(\r\n\t\t\t\ttentacular,\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(\r\n\t\t\t\tplayerEntity,\r\n\t\t\t\ttentacular[0],\r\n\t\t\t\tplayerBoard,\r\n\t\t\t\tplayerEntity,\r\n\t\t\t\topponentEntity,\r\n\t\t\t);\r\n\t\t\theroPower.activated = true;\r\n\t\t}\r\n\t}\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};\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};\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};\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"]}
|
|
@@ -5,7 +5,6 @@ const reference_data_1 = require("@firestone-hs/reference-data");
|
|
|
5
5
|
const utils_1 = require("../../utils");
|
|
6
6
|
const add_minion_to_board_1 = require("../add-minion-to-board");
|
|
7
7
|
const remove_minion_from_board_1 = require("../remove-minion-from-board");
|
|
8
|
-
const stats_1 = require("../stats");
|
|
9
8
|
const makeMinionGolden = (target, source, targetBoard, targetBoardHero, otherBoard, otherHero, gameState) => {
|
|
10
9
|
var _a;
|
|
11
10
|
if ((0, exports.isMinionGolden)(target, gameState.allCards)) {
|
|
@@ -20,7 +19,8 @@ const makeMinionGolden = (target, source, targetBoard, targetBoardHero, otherBoa
|
|
|
20
19
|
goldenCard = refCard;
|
|
21
20
|
}
|
|
22
21
|
target.cardId = goldenCard.id;
|
|
23
|
-
|
|
22
|
+
target.attack += refCard.attack;
|
|
23
|
+
target.health += refCard.health;
|
|
24
24
|
(0, add_minion_to_board_1.handleAddedMinionAuraEffect)(targetBoard, targetBoardHero, otherBoard, otherHero, target, gameState, true, false);
|
|
25
25
|
const hasDivineShield = target.divineShield;
|
|
26
26
|
const hasReborn = target.reborn;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"golden.js","sourceRoot":"","sources":["../../../src/simulation/utils/golden.ts"],"names":[],"mappings":";;;AAAA,iEAAiF;AAGjF,uCAAkD;AAClD,gEAAqE;AAErE,0EAA4E;AAC5E,oCAAuC;AAEhC,MAAM,gBAAgB,GAAG,CAC/B,MAAmB,EACnB,MAAqC,EACrC,WAA0B,EAC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GAAG,gBAAgB,CAAC,CAAC;YACvG,MAAM;KACP;AACF,CAAC,CAAC","sourcesContent":["import { AllCardsService, CardIds, GameTag } from '@firestone-hs/reference-data';\r\nimport { BgsPlayerEntity } from '../../bgs-player-entity';\r\nimport { BoardEntity } from '../../board-entity';\r\nimport { addImpliedMechanics } from '../../utils';\r\nimport { handleAddedMinionAuraEffect } from '../add-minion-to-board';\r\nimport { FullGameState } from '../internal-game-state';\r\nimport { handleMinionRemovedAuraEffect } from '../remove-minion-from-board';\r\nimport { modifyStats } from '../stats';\r\n\r\nexport const makeMinionGolden = (\r\n\ttarget: BoardEntity,\r\n\tsource: BoardEntity | BgsPlayerEntity,\r\n\ttargetBoard: BoardEntity[],\r\n\ttargetBoardHero: BgsPlayerEntity,\r\n\totherBoard: BoardEntity[],\r\n\totherHero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\t// Typically, we are already golden\r\n\tif (isMinionGolden(target, gameState.allCards)) {\r\n\t\treturn;\r\n\t}\r\n\r\n\tgameState.spectator.registerPowerTarget(source, target, targetBoard, null, null);\r\n\r\n\t// console.log('before transforming minion', stringifySimple(targetBoard, allCards));\r\n\thandleMinionRemovedAuraEffect(targetBoard, target, targetBoardHero, gameState);\r\n\t// Specific for making a minion golden\r\n\t// This is not handled in handleMinionRemovedAuraEffect, though I'm not entirely sure why. Maybe because it's a self-effect only?\r\n\t// Also, because of how I implemented auras and such, it's probably good to have something specific for golden\r\n\tremoveMinionAuraEffectsForGolden(target, targetBoardHero);\r\n\t// console.log('after removed effect', stringifySimple(targetBoard, allCards));\r\n\tconst refCard = gameState.allCards.getCard(target.cardId);\r\n\tlet goldenCard = gameState.allCards.getCardFromDbfId(refCard.battlegroundsPremiumDbfId);\r\n\t// Happens when there is no dedicated golden card, like for the Bettle token from Boon of Beetles\r\n\tif (!goldenCard?.id) {\r\n\t\tgoldenCard = refCard;\r\n\t}\r\n\r\n\t// A minion becoming golden ignore the current death.\r\n\t// This way of handling it is not ideal, since it will still trigger if both avenges trigger at the same time, but\r\n\t// should solve the other cases\r\n\t// Update 2024-06-21: I'm not sure what this is about exactly. See\r\n\t// http://replays.firestoneapp.com/?reviewId=5d94ebeb-3691-4509-88de-5d5418b20597&turn=11&action=2\r\n\t// The Sr. Tomb Diver dies, thus gilding the Phaerix. Two other deaths later, the avenge procs\r\n\t// This means the death of the diver counted normally\r\n\t// target.avengeCurrent = Math.min(target.avengeDefault, target.avengeCurrent + 1);\r\n\r\n\t// Only change the card ID after modifying the stats, so that some effects (like Tarecgosa) won't trigger\r\n\t// too early\r\n\t// TODO: add a replay with Tarec to illustrate the difference with Defiant Shipwright, and\r\n\t// check if there is something different with Tarec\r\n\ttarget.cardId = goldenCard.id;\r\n\r\n\t// The rule for golden minions is to add the base stats\r\n\t// TO CHECK: not sure that this is what actually happens (i.e. do minions that trigger on stats modifications\r\n\t// trigger?)\r\n\t// UPDATE 2024-06-20: Defiant Shipwright (2/5) going golden (4/10) actually ends up at 4/12 because\r\n\t// of the +2 health bonus\r\n\t// http://replays.firestoneapp.com/?reviewId=283dc44c-5fc8-40fb-af89-7d752a39f9b9&turn=7&action=1\r\n\t// BUT (2025-05-10) Tarecgosa going golden just becomes a 10/10, it doesn't get the x2 from the buff\r\n\t// Maybe that's because it's not an enchantment, so let's just hard-code this here\r\n\t// (bug: it won't work with Poets)\r\n\tmodifyStats(target, null, refCard.attack, refCard.health, targetBoard, targetBoardHero, gameState, true, false);\r\n\r\n\t// console.log('before adding new effect', stringifySimple(targetBoard, allCards));\r\n\thandleAddedMinionAuraEffect(targetBoard, targetBoardHero, otherBoard, otherHero, target, gameState, true, false);\r\n\tconst hasDivineShield = target.divineShield;\r\n\tconst hasReborn = target.reborn;\r\n\tconst avengeCurrent = target.avengeCurrent;\r\n\taddImpliedMechanics(target, gameState.cardsData);\r\n\r\n\t// addImpliedMechanics grants divine shield if the card has divine shield, or if the entity had\r\n\t// it at some point. That means that when we gild Zilliax: Defense Module (with Divine Shield) into\r\n\t// Zilliaw: Assembled, we restore the divine shield, while we shouldn't\r\n\ttarget.divineShield = hasDivineShield;\r\n\t// Update 2024-06-19: Hat tested on one of their build, and gilding a zilliax module should NOT\r\n\t// remove its divine shield / reborn status\r\n\t// Gilding a reborn Risen Rider results into a golden Risen Rider with reborn\r\n\t// http://replays.firestoneapp.com/?reviewId=c553c3e7-01e2-494d-80f8-69f33c08fb39&turn=7&action=4\r\n\ttarget.reborn = hasReborn || goldenCard.mechanics?.includes(GameTag[GameTag.REBORN]);\r\n\t// target.windfury = refGoldenCard.mechanics?.includes(GameTag[GameTag.WINDFURY]);\r\n\t// target.taunt = refGoldenCard.mechanics?.includes(GameTag[GameTag.TAUNT]);\r\n\t// target.stealth = refGoldenCard.mechanics?.includes(GameTag[GameTag.STEALTH]);\r\n\ttarget.avengeCurrent = avengeCurrent;\r\n\r\n\t// console.log('after adding new effect', stringifySimple(targetBoard, allCards));\r\n};\r\n\r\nexport const isMinionGolden = (entity: BoardEntity, allCards: AllCardsService): boolean => {\r\n\tconst ref = allCards.getCard(entity.cardId);\r\n\t// Some cards (like the Bettle token from Boon of Beetles) don't have a premium dbf id. However, we can still\r\n\t// gild it\r\n\treturn ref.premium;\r\n};\r\n\r\n// This feels wrong, and is probably an indicator that auras are not applied at the right time\r\nconst removeMinionAuraEffectsForGolden = (entity: BoardEntity, hero: BgsPlayerEntity) => {\r\n\tswitch (entity.cardId) {\r\n\t\tcase CardIds.EternalKnight_BG25_008:\r\n\t\tcase CardIds.EternalKnight_BG25_008_G:\r\n\t\t\tconst eternalKnightBuffToRemove = hero.globalInfo.EternalKnightsDeadThisGame;\r\n\t\t\tconst eternalKnighMultiplier = entity.cardId === CardIds.EternalKnight_BG25_008_G ? 2 : 1;\r\n\t\t\tentity.health = Math.max(1, entity.health - eternalKnighMultiplier * eternalKnightBuffToRemove);\r\n\t\t\tentity.attack = Math.max(0, entity.attack - eternalKnighMultiplier * eternalKnightBuffToRemove);\r\n\t\t\tbreak;\r\n\t\tcase CardIds.SanlaynScribe_BGDUO31_208:\r\n\t\tcase CardIds.SanlaynScribe_BGDUO31_208_G:\r\n\t\t\tconst sanlaynBuffToRemove = hero.globalInfo.SanlaynScribesDeadThisGame;\r\n\t\t\tconst sanlaynMultiplier = entity.cardId === CardIds.SanlaynScribe_BGDUO31_208_G ? 2 : 1;\r\n\t\t\tentity.health = Math.max(1, entity.health - sanlaynMultiplier * sanlaynBuffToRemove);\r\n\t\t\tentity.attack = Math.max(0, entity.attack - sanlaynMultiplier * sanlaynBuffToRemove);\r\n\t\t\tbreak;\r\n\t\tcase CardIds.AstralAutomaton_BG_TTN_401:\r\n\t\tcase CardIds.AstralAutomaton_BG_TTN_401_G:\r\n\t\t\tconst multiplierAstral = entity.cardId === CardIds.AstralAutomaton_BG_TTN_401_G ? 2 : 1;\r\n\t\t\t// Doesn't count self\r\n\t\t\tconst statsBonusAstralToRemove = hero.globalInfo.AstralAutomatonsSummonedThisGame - 1;\r\n\t\t\tentity.health = Math.max(1, entity.health - 3 * multiplierAstral * statsBonusAstralToRemove);\r\n\t\t\tentity.attack = Math.max(0, entity.attack - 2 * multiplierAstral * statsBonusAstralToRemove);\r\n\t\t\tbreak;\r\n\t\tcase CardIds.DrBoomsMonster_BG31_176:\r\n\t\tcase CardIds.DrBoomsMonster_BG31_176_G:\r\n\t\t\tconst multiplierDrBoom = entity.cardId === CardIds.DrBoomsMonster_BG31_176_G ? 2 : 1;\r\n\t\t\tentity.health = Math.max(1, entity.health - 2 * hero.globalInfo.MagnetizedThisGame * multiplierDrBoom);\r\n\t\t\tentity.attack = Math.max(0, entity.attack - 2 * hero.globalInfo.MagnetizedThisGame * multiplierDrBoom);\r\n\t\t\tbreak;\r\n\t}\r\n};\r\n"]}
|
|
1
|
+
{"version":3,"file":"golden.js","sourceRoot":"","sources":["../../../src/simulation/utils/golden.ts"],"names":[],"mappings":";;;AAAA,iEAAiF;AAGjF,uCAAkD;AAClD,gEAAqE;AAErE,0EAA4E;AAErE,MAAM,gBAA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AAG,gBAAgB,CAAC,CAAC;YACvG,MAAM;KACP;AACF,CAAC,CAAC","sourcesContent":["import { AllCardsService, CardIds, GameTag } from '@firestone-hs/reference-data';\r\nimport { BgsPlayerEntity } from '../../bgs-player-entity';\r\nimport { BoardEntity } from '../../board-entity';\r\nimport { addImpliedMechanics } from '../../utils';\r\nimport { handleAddedMinionAuraEffect } from '../add-minion-to-board';\r\nimport { FullGameState } from '../internal-game-state';\r\nimport { handleMinionRemovedAuraEffect } from '../remove-minion-from-board';\r\n\r\nexport const makeMinionGolden = (\r\n\ttarget: BoardEntity,\r\n\tsource: BoardEntity | BgsPlayerEntity,\r\n\ttargetBoard: BoardEntity[],\r\n\ttargetBoardHero: BgsPlayerEntity,\r\n\totherBoard: BoardEntity[],\r\n\totherHero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\t// Typically, we are already golden\r\n\tif (isMinionGolden(target, gameState.allCards)) {\r\n\t\treturn;\r\n\t}\r\n\r\n\tgameState.spectator.registerPowerTarget(source, target, targetBoard, null, null);\r\n\r\n\t// console.log('before transforming minion', stringifySimple(targetBoard, allCards));\r\n\thandleMinionRemovedAuraEffect(targetBoard, target, targetBoardHero, gameState);\r\n\t// Specific for making a minion golden\r\n\t// This is not handled in handleMinionRemovedAuraEffect, though I'm not entirely sure why. Maybe because it's a self-effect only?\r\n\t// Also, because of how I implemented auras and such, it's probably good to have something specific for golden\r\n\tremoveMinionAuraEffectsForGolden(target, targetBoardHero);\r\n\t// console.log('after removed effect', stringifySimple(targetBoard, allCards));\r\n\tconst refCard = gameState.allCards.getCard(target.cardId);\r\n\tlet goldenCard = gameState.allCards.getCardFromDbfId(refCard.battlegroundsPremiumDbfId);\r\n\t// Happens when there is no dedicated golden card, like for the Bettle token from Boon of Beetles\r\n\tif (!goldenCard?.id) {\r\n\t\tgoldenCard = refCard;\r\n\t}\r\n\r\n\t// A minion becoming golden ignore the current death.\r\n\t// This way of handling it is not ideal, since it will still trigger if both avenges trigger at the same time, but\r\n\t// should solve the other cases\r\n\t// Update 2024-06-21: I'm not sure what this is about exactly. See\r\n\t// http://replays.firestoneapp.com/?reviewId=5d94ebeb-3691-4509-88de-5d5418b20597&turn=11&action=2\r\n\t// The Sr. Tomb Diver dies, thus gilding the Phaerix. Two other deaths later, the avenge procs\r\n\t// This means the death of the diver counted normally\r\n\t// target.avengeCurrent = Math.min(target.avengeDefault, target.avengeCurrent + 1);\r\n\r\n\t// Only change the card ID after modifying the stats, so that some effects (like Tarecgosa) won't trigger\r\n\t// too early\r\n\t// TODO: add a replay with Tarec to illustrate the difference with Defiant Shipwright, and\r\n\t// check if there is something different with Tarec\r\n\ttarget.cardId = goldenCard.id;\r\n\r\n\t// The rule for golden minions is to add the base stats\r\n\t// TO CHECK: not sure that this is what actually happens (i.e. do minions that trigger on stats modifications\r\n\t// trigger?)\r\n\t// UPDATE 2024-06-20: Defiant Shipwright (2/5) going golden (4/10) actually ends up at 4/12 because\r\n\t// of the +2 health bonus\r\n\t// http://replays.firestoneapp.com/?reviewId=283dc44c-5fc8-40fb-af89-7d752a39f9b9&turn=7&action=1\r\n\t// BUT (2025-05-10) Tarecgosa going golden just becomes a 10/10, it doesn't get the x2 from the buff\r\n\t// Maybe that's because it's not an enchantment, so let's just hard-code this here\r\n\t// (bug: it won't work with Poets)\r\n\t// Update 2025-05-05: Whelp Smuggler going golden doesn't not trigger the other whelp smuggler stat buff\r\n\t// https://replays.firestoneapp.com/?reviewId=253ddf7c-be1b-44f4-aa78-9a23442d3687&turn=15&action=0\r\n\t// So I'm just modifying the stats here without triggering any side-effects\r\n\ttarget.attack += refCard.attack;\r\n\ttarget.health += refCard.health;\r\n\t// modifyStats(target, null, refCard.attack, refCard.health, targetBoard, targetBoardHero, gameState, true, false);\r\n\r\n\t// console.log('before adding new effect', stringifySimple(targetBoard, allCards));\r\n\thandleAddedMinionAuraEffect(targetBoard, targetBoardHero, otherBoard, otherHero, target, gameState, true, false);\r\n\tconst hasDivineShield = target.divineShield;\r\n\tconst hasReborn = target.reborn;\r\n\tconst avengeCurrent = target.avengeCurrent;\r\n\taddImpliedMechanics(target, gameState.cardsData);\r\n\r\n\t// addImpliedMechanics grants divine shield if the card has divine shield, or if the entity had\r\n\t// it at some point. That means that when we gild Zilliax: Defense Module (with Divine Shield) into\r\n\t// Zilliaw: Assembled, we restore the divine shield, while we shouldn't\r\n\ttarget.divineShield = hasDivineShield;\r\n\t// Update 2024-06-19: Hat tested on one of their build, and gilding a zilliax module should NOT\r\n\t// remove its divine shield / reborn status\r\n\t// Gilding a reborn Risen Rider results into a golden Risen Rider with reborn\r\n\t// http://replays.firestoneapp.com/?reviewId=c553c3e7-01e2-494d-80f8-69f33c08fb39&turn=7&action=4\r\n\ttarget.reborn = hasReborn || goldenCard.mechanics?.includes(GameTag[GameTag.REBORN]);\r\n\t// target.windfury = refGoldenCard.mechanics?.includes(GameTag[GameTag.WINDFURY]);\r\n\t// target.taunt = refGoldenCard.mechanics?.includes(GameTag[GameTag.TAUNT]);\r\n\t// target.stealth = refGoldenCard.mechanics?.includes(GameTag[GameTag.STEALTH]);\r\n\ttarget.avengeCurrent = avengeCurrent;\r\n\r\n\t// console.log('after adding new effect', stringifySimple(targetBoard, allCards));\r\n};\r\n\r\nexport const isMinionGolden = (entity: BoardEntity, allCards: AllCardsService): boolean => {\r\n\tconst ref = allCards.getCard(entity.cardId);\r\n\t// Some cards (like the Bettle token from Boon of Beetles) don't have a premium dbf id. However, we can still\r\n\t// gild it\r\n\treturn ref.premium;\r\n};\r\n\r\n// This feels wrong, and is probably an indicator that auras are not applied at the right time\r\nconst removeMinionAuraEffectsForGolden = (entity: BoardEntity, hero: BgsPlayerEntity) => {\r\n\tswitch (entity.cardId) {\r\n\t\tcase CardIds.EternalKnight_BG25_008:\r\n\t\tcase CardIds.EternalKnight_BG25_008_G:\r\n\t\t\tconst eternalKnightBuffToRemove = hero.globalInfo.EternalKnightsDeadThisGame;\r\n\t\t\tconst eternalKnighMultiplier = entity.cardId === CardIds.EternalKnight_BG25_008_G ? 2 : 1;\r\n\t\t\tentity.health = Math.max(1, entity.health - eternalKnighMultiplier * eternalKnightBuffToRemove);\r\n\t\t\tentity.attack = Math.max(0, entity.attack - eternalKnighMultiplier * eternalKnightBuffToRemove);\r\n\t\t\tbreak;\r\n\t\tcase CardIds.SanlaynScribe_BGDUO31_208:\r\n\t\tcase CardIds.SanlaynScribe_BGDUO31_208_G:\r\n\t\t\tconst sanlaynBuffToRemove = hero.globalInfo.SanlaynScribesDeadThisGame;\r\n\t\t\tconst sanlaynMultiplier = entity.cardId === CardIds.SanlaynScribe_BGDUO31_208_G ? 2 : 1;\r\n\t\t\tentity.health = Math.max(1, entity.health - sanlaynMultiplier * sanlaynBuffToRemove);\r\n\t\t\tentity.attack = Math.max(0, entity.attack - sanlaynMultiplier * sanlaynBuffToRemove);\r\n\t\t\tbreak;\r\n\t\tcase CardIds.AstralAutomaton_BG_TTN_401:\r\n\t\tcase CardIds.AstralAutomaton_BG_TTN_401_G:\r\n\t\t\tconst multiplierAstral = entity.cardId === CardIds.AstralAutomaton_BG_TTN_401_G ? 2 : 1;\r\n\t\t\t// Doesn't count self\r\n\t\t\tconst statsBonusAstralToRemove = hero.globalInfo.AstralAutomatonsSummonedThisGame - 1;\r\n\t\t\tentity.health = Math.max(1, entity.health - 3 * multiplierAstral * statsBonusAstralToRemove);\r\n\t\t\tentity.attack = Math.max(0, entity.attack - 2 * multiplierAstral * statsBonusAstralToRemove);\r\n\t\t\tbreak;\r\n\t\tcase CardIds.DrBoomsMonster_BG31_176:\r\n\t\tcase CardIds.DrBoomsMonster_BG31_176_G:\r\n\t\t\tconst multiplierDrBoom = entity.cardId === CardIds.DrBoomsMonster_BG31_176_G ? 2 : 1;\r\n\t\t\tentity.health = Math.max(1, entity.health - 2 * hero.globalInfo.MagnetizedThisGame * multiplierDrBoom);\r\n\t\t\tentity.attack = Math.max(0, entity.attack - 2 * hero.globalInfo.MagnetizedThisGame * multiplierDrBoom);\r\n\t\t\tbreak;\r\n\t}\r\n};\r\n"]}
|
package/dist/utils.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ export declare const grantRandomStats: (source: BoardEntity, board: BoardEntity[
|
|
|
13
13
|
export declare const getRandomAliveMinion: (board: BoardEntity[], hero: BgsPlayerEntity, race: Race, gameState: FullGameState) => BoardEntity;
|
|
14
14
|
export declare const getRandomRevivableMinion: (board: BoardEntity[], hero: BgsPlayerEntity, race: Race, gameState: FullGameState) => BoardEntity;
|
|
15
15
|
export declare const getRandomMinionWithHighestHealth: (board: BoardEntity[]) => BoardEntity;
|
|
16
|
-
export declare const addStatsToBoard: (sourceEntity: BoardEntity | BgsPlayerEntity | BoardSecret, board: BoardEntity[], hero: BgsPlayerEntity, attack: number, health: number, gameState: FullGameState, tribe?: string) => void;
|
|
16
|
+
export declare const addStatsToBoard: (sourceEntity: BoardEntity | BgsPlayerEntity | BoardSecret, board: BoardEntity[], hero: BgsPlayerEntity, attack: number, health: number, gameState: FullGameState, tribe?: string, countsAsStatsGain?: boolean) => void;
|
|
17
17
|
export declare const addStatsToAliveBoard: (sourceEntity: BoardEntity | BgsPlayerEntity | BoardSecret, board: BoardEntity[], hero: BgsPlayerEntity, attack: number, health: number, gameState: FullGameState, tribe?: string) => void;
|
|
18
18
|
export declare const grantStatsToMinionsOfEachType: (source: BoardEntity, board: BoardEntity[], hero: BgsPlayerEntity, attack: number, health: number, gameState: FullGameState, numberOfDifferentTypes?: number, canRevive?: boolean) => void;
|
|
19
19
|
export declare const getMinionsOfDifferentTypes: (board: BoardEntity[], hero: BgsPlayerEntity, gameState: FullGameState, canRevive?: boolean, numberOfDifferentTypes?: number) => BoardEntity[];
|
package/dist/utils.js
CHANGED
|
@@ -192,10 +192,16 @@ const getRandomMinionWithHighestHealth = (board) => {
|
|
|
192
192
|
return validMinions[Math.floor(Math.random() * validMinions.length)];
|
|
193
193
|
};
|
|
194
194
|
exports.getRandomMinionWithHighestHealth = getRandomMinionWithHighestHealth;
|
|
195
|
-
const addStatsToBoard = (sourceEntity, board, hero, attack, health, gameState, tribe) => {
|
|
195
|
+
const addStatsToBoard = (sourceEntity, board, hero, attack, health, gameState, tribe, countsAsStatsGain = true) => {
|
|
196
196
|
for (const entity of board) {
|
|
197
197
|
if (!tribe || (0, exports.hasCorrectTribe)(entity, hero, reference_data_1.Race[tribe], gameState.anomalies, gameState.allCards)) {
|
|
198
|
-
(
|
|
198
|
+
if (countsAsStatsGain) {
|
|
199
|
+
(0, stats_1.modifyStats)(entity, sourceEntity, attack, health, board, hero, gameState);
|
|
200
|
+
}
|
|
201
|
+
else {
|
|
202
|
+
entity.attack += attack;
|
|
203
|
+
entity.health += health;
|
|
204
|
+
}
|
|
199
205
|
}
|
|
200
206
|
}
|
|
201
207
|
};
|