@firestone-hs/simulate-bgs-battle 1.1.589 → 1.1.591
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/bgs-player-entity.d.ts +1 -1
- package/dist/bgs-player-entity.js.map +1 -1
- package/dist/cards/cards-data.js +1 -1
- package/dist/cards/cards-data.js.map +1 -1
- package/dist/cards/impl/minion/apprentice-of-sefin.js +1 -1
- package/dist/cards/impl/minion/apprentice-of-sefin.js.map +1 -1
- package/dist/cards/impl/minion/fire-forged-evoker.js +6 -1
- package/dist/cards/impl/minion/fire-forged-evoker.js.map +1 -1
- package/dist/cards/impl/minion/hackerfin.js +5 -3
- package/dist/cards/impl/minion/hackerfin.js.map +1 -1
- package/dist/cards/impl/minion/king-bagurgle.js +1 -1
- package/dist/cards/impl/minion/king-bagurgle.js.map +1 -1
- package/dist/cards/impl/minion/mechagnome-interpreter.js +1 -1
- package/dist/cards/impl/minion/mechagnome-interpreter.js.map +1 -1
- package/dist/cards/impl/minion/murky.js +1 -1
- package/dist/cards/impl/minion/murky.js.map +1 -1
- package/dist/cards/impl/minion/mutalisk.js.map +1 -1
- package/dist/cards/impl/minion/wildfire-elemental.js +1 -1
- package/dist/cards/impl/minion/wildfire-elemental.js.map +1 -1
- package/dist/simulation/add-minion-to-board.js +2 -2
- package/dist/simulation/add-minion-to-board.js.map +1 -1
- package/dist/simulation/attack.d.ts +1 -0
- package/dist/simulation/attack.js.map +1 -1
- package/dist/simulation/deathrattle-effects.js +2 -1
- package/dist/simulation/deathrattle-effects.js.map +1 -1
- package/dist/simulation/deathrattle-orchestration.js +2 -2
- package/dist/simulation/deathrattle-orchestration.js.map +1 -1
- package/dist/simulation/minion-kill.js +17 -14
- package/dist/simulation/minion-kill.js.map +1 -1
- package/dist/simulation/utils/golden.js +1 -1
- package/dist/simulation/utils/golden.js.map +1 -1
- package/package.json +1 -1
|
@@ -43,7 +43,7 @@ const removeMinionAuraEffectsForGolden = (entity, hero) => {
|
|
|
43
43
|
const eternalKnightBuffToRemove = hero.globalInfo.EternalKnightsDeadThisGame;
|
|
44
44
|
const eternalKnighMultiplier = entity.cardId === "BG25_008_G" ? 2 : 1;
|
|
45
45
|
entity.health = Math.max(1, entity.health - eternalKnighMultiplier * eternalKnightBuffToRemove);
|
|
46
|
-
entity.attack = Math.max(0, entity.attack - eternalKnighMultiplier * eternalKnightBuffToRemove);
|
|
46
|
+
entity.attack = Math.max(0, entity.attack - 2 * eternalKnighMultiplier * eternalKnightBuffToRemove);
|
|
47
47
|
break;
|
|
48
48
|
case "BGDUO31_208":
|
|
49
49
|
case "BGDUO31_208_G":
|
|
@@ -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;AAErE,MAAM,gBAAgB,GAAG,CAC/B,MAAmB,EACnB,MAAqC,EACrC,WAA0B,EAC1B,eAAgC,EAChC,UAAyB,EACzB,SAA0B,EAC1B,SAAwB,EACjB,EAAE;;IAET,IAAI,IAAA,sBAAc,EAAC,MAAM,EAAE,SAAS,CAAC,QAAQ,CAAC,EAAE;QAC/C,OAAO;KACP;IAED,SAAS,CAAC,SAAS,CAAC,mBAAmB,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;IAGjF,IAAA,wDAA6B,EAAC,WAAW,EAAE,MAAM,EAAE,eAAe,EAAE,SAAS,CAAC,CAAC;IAI/E,gCAAgC,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;IAE1D,MAAM,OAAO,GAAG,SAAS,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAC1D,IAAI,UAAU,GAAG,SAAS,CAAC,QAAQ,CAAC,gBAAgB,CAAC,OAAO,CAAC,yBAAyB,CAAC,CAAC;IAExF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AC,CAAC;YAC7F,MAAM,CAAC,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,MAAM,CAAC,MAAM,GAAG,CAAC,GAAG,gBAAgB,GAAG,wBAAwB,CAAC,CAAC;YAC7F,MAAM;QACP,gBAAqC;QACrC;YACC,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,iBAAsC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YACrF,MAAM,CAAC,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,MAAM,CAAC,MAAM,GAAG,CAAC,GAAG,IAAI,CAAC,UAAU,CAAC,kBAAkB,GAAG,gBAAgB,CAAC,CAAC;YACvG,MAAM,CAAC,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,MAAM,CAAC,MAAM,GAAG,CAAC,GAAG,IAAI,CAAC,UAAU,CAAC,kBAAkB,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\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"]}
|
|
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,gBAAgB,GAAG,CAC/B,MAAmB,EACnB,MAAqC,EACrC,WAA0B,EAC1B,eAAgC,EAChC,UAAyB,EACzB,SAA0B,EAC1B,SAAwB,EACjB,EAAE;;IAET,IAAI,IAAA,sBAAc,EAAC,MAAM,EAAE,SAAS,CAAC,QAAQ,CAAC,EAAE;QAC/C,OAAO;KACP;IAED,SAAS,CAAC,SAAS,CAAC,mBAAmB,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;IAGjF,IAAA,wDAA6B,EAAC,WAAW,EAAE,MAAM,EAAE,eAAe,EAAE,SAAS,CAAC,CAAC;IAI/E,gCAAgC,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;IAE1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ExF,MAAM,wBAAwB,GAAG,IAAI,CAAC,UAAU,CAAC,gCAAgC,GAAG,CAAC,CAAC;YACtF,MAAM,CAAC,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,MAAM,CAAC,MAAM,GAAG,CAAC,GAAG,gBAAgB,GAAG,wBAAwB,CAAC,CAAC;YAC7F,MAAM,CAAC,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,MAAM,CAAC,MAAM,GAAG,CAAC,GAAG,gBAAgB,GAAG,wBAAwB,CAAC,CAAC;YAC7F,MAAM;QACP,gBAAqC;QACrC;YACC,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,iBAAsC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YACrF,MAAM,CAAC,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,MAAM,CAAC,MAAM,GAAG,CAAC,GAAG,IAAI,CAAC,UAAU,CAAC,kBAAkB,GAAG,gBAAgB,CAAC,CAAC;YACvG,MAAM,CAAC,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,MAAM,CAAC,MAAM,GAAG,CAAC,GAAG,IAAI,CAAC,UAAU,CAAC,kBAAkB,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\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 - 2 * 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"]}
|