@firestone-hs/simulate-bgs-battle 1.1.748 → 1.1.749
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cards/card.interface.d.ts +9 -0
- package/dist/cards/card.interface.js +5 -1
- package/dist/cards/card.interface.js.map +1 -1
- package/dist/cards/impl/_card-mappings.js +4 -0
- package/dist/cards/impl/_card-mappings.js.map +1 -1
- package/dist/cards/impl/enchantments/deaths-embrace.js.map +1 -1
- package/dist/cards/impl/enchantments/spell-siphon.d.ts +2 -0
- package/dist/cards/impl/enchantments/spell-siphon.js +22 -0
- package/dist/cards/impl/enchantments/spell-siphon.js.map +1 -0
- package/dist/cards/impl/minion/captain-cookie.d.ts +2 -0
- package/dist/cards/impl/minion/captain-cookie.js +14 -0
- package/dist/cards/impl/minion/captain-cookie.js.map +1 -0
- package/dist/cards/impl/minion/showy-cyclist.d.ts +2 -2
- package/dist/cards/impl/minion/showy-cyclist.js +9 -3
- package/dist/cards/impl/minion/showy-cyclist.js.map +1 -1
- package/dist/cards/impl/minion/tasty-lobster.d.ts +2 -0
- package/dist/cards/impl/minion/tasty-lobster.js +5 -3
- package/dist/cards/impl/minion/tasty-lobster.js.map +1 -1
- package/dist/cards/impl/minion/wildfire-elemental.js +8 -3
- package/dist/cards/impl/minion/wildfire-elemental.js.map +1 -1
- package/dist/simulation/attack.d.ts +1 -0
- package/dist/simulation/attack.js +12 -8
- package/dist/simulation/attack.js.map +1 -1
- package/dist/simulation/auras.js +4 -1
- package/dist/simulation/auras.js.map +1 -1
- package/dist/simulation/global-info-helpers.js +11 -0
- package/dist/simulation/global-info-helpers.js.map +1 -1
- package/dist/simulation/minion-kill.d.ts +1 -1
- package/dist/simulation/minion-kill.js +2 -1
- package/dist/simulation/minion-kill.js.map +1 -1
- package/dist/simulation/utils/golden.d.ts +9 -0
- package/dist/simulation/utils/golden.js +14 -0
- package/dist/simulation/utils/golden.js.map +1 -1
- package/package.json +1 -1
|
@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E,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE;QACxE,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAA,uBAAa,EAAC,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC,CAAC;QACjF,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAA,uBAAa,EAAC,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC;KAC3F;AACF,CAAC,CAAC;AAlBW,QAAA,oBAAoB,wBAkB/B","sourcesContent":["/* eslint-disable @typescript-eslint/no-use-before-define */\r\nimport { AllCardsService, Race } from '@firestone-hs/reference-data';\r\nimport { BgsPlayerEntity } from '../bgs-player-entity';\r\nimport { BoardEntity } from '../board-entity';\r\nimport { CardsData } from '../cards/cards-data';\r\nimport { updateStealth } from '../keywords/stealth';\r\nimport { CardIds } from '../services/card-ids';\r\nimport { addImpliedMechanics, hasCorrectTribe } from '../utils';\r\nimport { FullGameState } from './internal-game-state';\r\n\r\nexport const setMissingAuras = (\r\n\tboard: BoardEntity[],\r\n\tboardHero: BgsPlayerEntity,\r\n\tanomalies: readonly string[],\r\n\tallCards: AllCardsService,\r\n): void => {\r\n\tsetMissingMinionsAura(board, boardHero, anomalies, allCards);\r\n\tsetMissingHeroPowerAura(board, boardHero);\r\n\tsetMissingTrinketAura(board, boardHero);\r\n};\r\n\r\nexport const setMissingTrinketAura = (board: BoardEntity[], boardHero: BgsPlayerEntity): void => {\r\n\tfor (const trinket of boardHero.trinkets ?? []) {\r\n\t\t// switch (trinket.cardId) {\r\n\t\t// \tcase CardIds.WindrunnerNecklace_BG30_MagicItem_997:\r\n\t\t// \tcase CardIds.WindrunnerNecklace_WindrunnerNecklaceToken_BG30_MagicItem_997t:\r\n\t\t// \t\tconst enchantment =\r\n\t\t// \t\t\ttrinket.cardId === CardIds.WindrunnerNecklace_BG30_MagicItem_997\r\n\t\t// \t\t\t\t? CardIds.WindrunnerNecklace_RunningLikeTheWindEnchantment_BG30_MagicItem_997e\r\n\t\t// \t\t\t\t: CardIds.WindrunnerNecklace_RunningLikeTheWindEnchantment_BG30_MagicItem_997e2;\r\n\t\t// \t\tconst buff = trinket.cardId === CardIds.WindrunnerNecklace_BG30_MagicItem_997 ? 8 : 20;\r\n\t\t// \t\tconst target = board[0];\r\n\t\t// \t\tif (!!target && !target.enchantments?.find((e) => e.cardId === enchantment)) {\r\n\t\t// \t\t\ttarget.attack += buff;\r\n\t\t// \t\t\ttarget.enchantments.push({\r\n\t\t// \t\t\t\tcardId: enchantment,\r\n\t\t// \t\t\t\toriginEntityId: trinket.entityId,\r\n\t\t// \t\t\t\ttiming: 0,\r\n\t\t// \t\t\t});\r\n\t\t// \t\t}\r\n\t\t// \t\tbreak;\r\n\t\t// }\r\n\t}\r\n};\r\n\r\nexport const setMissingHeroPowerAura = (board: BoardEntity[], boardHero: BgsPlayerEntity): void => {\r\n\tfor (const heroPower of boardHero.heroPowers) {\r\n\t\tif (heroPower.cardId === CardIds.TheSmokingGun) {\r\n\t\t\tboard\r\n\t\t\t\t.filter(\r\n\t\t\t\t\t(e) =>\r\n\t\t\t\t\t\t!e.enchantments.find(\r\n\t\t\t\t\t\t\t(ench) => ench.cardId === CardIds.TheSmokingGun_ArmedAndStillSmokingEnchantment,\r\n\t\t\t\t\t\t),\r\n\t\t\t\t)\r\n\t\t\t\t.forEach((e) => {\r\n\t\t\t\t\te.attack += 4;\r\n\t\t\t\t});\r\n\t\t}\r\n\t\tif (heroPower.cardId === CardIds.VolatileVenom) {\r\n\t\t\tboard\r\n\t\t\t\t.filter(\r\n\t\t\t\t\t(e) => !e.enchantments.find((ench) => ench.cardId === CardIds.VolatileVenom_VolatileEnchantment),\r\n\t\t\t\t)\r\n\t\t\t\t.forEach((e) => {\r\n\t\t\t\t\te.attack += 7;\r\n\t\t\t\t\te.health += 7;\r\n\t\t\t\t\te.enchantments.push({\r\n\t\t\t\t\t\tcardId: CardIds.VolatileVenom_VolatileEnchantment,\r\n\t\t\t\t\t\toriginEntityId: undefined,\r\n\t\t\t\t\t\ttiming: 0,\r\n\t\t\t\t\t});\r\n\t\t\t\t});\r\n\t\t}\r\n\t}\r\n};\r\n\r\nconst setMissingMinionsAura = (\r\n\tboard: BoardEntity[],\r\n\tboardHero: BgsPlayerEntity,\r\n\tanomalies: readonly string[],\r\n\tallCards: AllCardsService,\r\n): void => {\r\n\tconst pirates: BoardEntity[] = [];\r\n\tconst murlocs: BoardEntity[] = [];\r\n\tconst undead: BoardEntity[] = [];\r\n\tconst divineShielded: BoardEntity[] = [];\r\n\tfor (const e of board) {\r\n\t\tif (e.divineShield) {\r\n\t\t\tdivineShielded.push(e);\r\n\t\t}\r\n\t\tif (hasCorrectTribe(e, boardHero, Race.PIRATE, anomalies, allCards)) {\r\n\t\t\tpirates.push(e);\r\n\t\t}\r\n\t\tif (hasCorrectTribe(e, boardHero, Race.MURLOC, anomalies, allCards)) {\r\n\t\t\tmurlocs.push(e);\r\n\t\t}\r\n\t\tif (hasCorrectTribe(e, boardHero, Race.UNDEAD, anomalies, allCards)) {\r\n\t\t\tundead.push(e);\r\n\t\t}\r\n\t}\r\n\tsetMissingAura(\r\n\t\tpirates,\r\n\t\tCardIds.SouthseaCaptainLegacy_BG_NEW1_027,\r\n\t\tCardIds.SouthseaCaptain_YarrrVanillaEnchantment,\r\n\t\t1,\r\n\t\t1,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tpirates,\r\n\t\tCardIds.SouthseaCaptainLegacy_TB_BaconUps_136,\r\n\t\tCardIds.SouthseaCaptain_YarrrEnchantment,\r\n\t\t2,\r\n\t\t2,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tmurlocs,\r\n\t\tCardIds.MurlocWarleaderLegacy_BG_EX1_507,\r\n\t\tCardIds.MurlocWarleader_MrgglaarglLegacyEnchantment,\r\n\t\t2,\r\n\t\t0,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tdivineShielded,\r\n\t\tCardIds.CyborgDrake_BG25_043,\r\n\t\tCardIds.CyborgDrake_CyborgEnhancementEnchantment_BG25_043e,\r\n\t\t6,\r\n\t\t0,\r\n\t\tfalse,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tundead,\r\n\t\tCardIds.SoreLoser_BG27_030,\r\n\t\tCardIds.SoreLoser_NoImWinningEnchantment_BG27_030e,\r\n\t\tboardHero.tavernTier,\r\n\t\t0,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tundead,\r\n\t\tCardIds.SoreLoser_BG27_030_G,\r\n\t\tCardIds.SoreLoser_NoImWinningEnchantment_BG27_030e,\r\n\t\t2 * boardHero.tavernTier,\r\n\t\t0,\r\n\t);\r\n};\r\n\r\nconst setMissingAura = (\r\n\tboard: BoardEntity[],\r\n\tminionCardId: string,\r\n\tenchantmentCardId: string,\r\n\tattack: number,\r\n\thealth: number,\r\n\tignoreSelf = true,\r\n\tallCards: AllCardsService = null,\r\n): void => {\r\n\tconst buffers = board.filter((e) => e.cardId === minionCardId);\r\n\tfor (const buffer of buffers) {\r\n\t\tboard\r\n\t\t\t.filter((e) => !e.enchantments.find((ench) => ench.cardId === enchantmentCardId))\r\n\t\t\t.filter((e) => (ignoreSelf ? e.entityId !== buffer.entityId : true))\r\n\t\t\t.forEach((e) => {\r\n\t\t\t\te.attack += attack;\r\n\t\t\t\te.health += health;\r\n\t\t\t});\r\n\t}\r\n};\r\n\r\nexport const setImplicitDataHero = (\r\n\thero: BgsPlayerEntity,\r\n\tboard: BoardEntity[],\r\n\tcardsData: CardsData,\r\n\tisPlayer: boolean,\r\n\tentityIdContainer: { entityId: number },\r\n): void => {\r\n\tfor (const heroPower of hero.heroPowers) {\r\n\t\tconst avengeValue = cardsData.avengeValue(heroPower.cardId);\r\n\t\tif (avengeValue > 0) {\r\n\t\t\theroPower.avengeCurrent = avengeValue - (heroPower.scoreValue2 ?? 0);\r\n\t\t\theroPower.avengeDefault = avengeValue;\r\n\t\t}\r\n\t\tif ((heroPower.info as BoardEntity)?.health) {\r\n\t\t\taddImpliedMechanics(heroPower.info as BoardEntity, cardsData);\r\n\t\t}\r\n\t}\r\n\t// Backward compatibility\r\n\tif (!!hero.questRewards?.length && !Array.isArray(hero.questRewards)) {\r\n\t\thero.questRewards = [hero.questRewards as any];\r\n\t}\r\n\r\n\t// Because Denathrius can send a quest reward as its hero power (I think)\r\n\t// For now deactivating this, until I have a scenario where this matters. It feels like\r\n\t// this should be a display issue only, as quest rewards are also handled in the code\r\n\tconst heroPowerAsReward = null; // hero.cardId === CardIds.SireDenathrius_BG24_HERO_100 ? hero.heroPowers[0]?.cardId : null;\r\n\thero.questRewards = [...(hero.questRewards ?? []), heroPowerAsReward].filter((e) => !!e);\r\n\thero.questRewardEntities = hero.questRewardEntities\r\n\t\t? hero.questRewardEntities.map((reward: any) => ({\r\n\t\t\t\tcardId: reward.CardId,\r\n\t\t\t\tscriptDataNum1: reward.ScriptDataNum1 ?? 0,\r\n\t\t\t\tentityId: entityIdContainer.entityId--,\r\n\t\t\t\tavengeDefault: cardsData.avengeValue(reward.CardId),\r\n\t\t\t\tavengeCurrent: cardsData.avengeValue(reward.CardId),\r\n\t\t }))\r\n\t\t: hero.questRewards.map((reward) => ({\r\n\t\t\t\tcardId: reward,\r\n\t\t\t\tentityId: entityIdContainer.entityId--,\r\n\t\t\t\tavengeCurrent: cardsData.avengeValue(reward),\r\n\t\t\t\tavengeDefault: cardsData.avengeValue(reward),\r\n\t\t\t\tscriptDataNum1: cardsData.defaultScriptDataNum(reward),\r\n\t\t }));\r\n\thero.trinkets = (hero.trinkets ?? [])\r\n\t\t.map((trinket) => ({\r\n\t\t\t...trinket,\r\n\t\t\tavengeDefault: cardsData.avengeValue(trinket.cardId),\r\n\t\t\tavengeCurrent: cardsData.avengeValue(trinket.cardId),\r\n\t\t\t// Use scriptDataNum1 to keep the info from the input\r\n\t\t\t// We don't want to use the default value is the value from the game state is 0\r\n\t\t\t// In that case, we probably want to use the ChargesLeft mechanism\r\n\t\t\tscriptDataNum1: trinket.scriptDataNum1 ?? cardsData.defaultScriptDataNum(trinket.cardId),\r\n\t\t}))\r\n\t\t.sort((a, b) => a.entityId - b.entityId);\r\n\t// 0 is not a valid entityId\r\n\thero.entityId = hero.entityId || entityIdContainer.entityId--;\r\n\thero.hand = hero.hand ?? [];\r\n\thero.enchantments = hero.enchantments ?? [];\r\n\tif (!hero.globalInfo) {\r\n\t\thero.globalInfo = {};\r\n\t}\r\n\r\n\thero.globalInfo.PirateAttackBonus = hero.globalInfo.PirateAttackBonus ?? 0;\r\n\thero.globalInfo.MechAttackBonus = hero.globalInfo.MechAttackBonus ?? 0;\r\n\thero.globalInfo.EternalKnightsDeadThisGame = hero.globalInfo.EternalKnightsDeadThisGame ?? 0;\r\n\thero.globalInfo.EternalKnightAttackBuff = hero.globalInfo.EternalKnightAttackBuff ?? 0;\r\n\thero.globalInfo.EternalKnightHealthBuff = hero.globalInfo.EternalKnightHealthBuff ?? 0;\r\n\thero.globalInfo.SanlaynScribesDeadThisGame = hero.globalInfo.SanlaynScribesDeadThisGame ?? 0;\r\n\thero.globalInfo.BeastsSummonedThisGame = hero.globalInfo.BeastsSummonedThisGame ?? 0;\r\n\thero.globalInfo.BeastsSummonedThisCombat = hero.globalInfo.BeastsSummonedThisCombat ?? 0;\r\n\thero.globalInfo.MagnetizedThisGame = hero.globalInfo.MagnetizedThisGame ?? 0;\r\n\thero.globalInfo.PiratesSummonedThisGame = hero.globalInfo.PiratesSummonedThisGame ?? 0;\r\n\thero.globalInfo.AstralAutomatonsSummonedThisGame = hero.globalInfo.AstralAutomatonsSummonedThisGame ?? 0;\r\n\thero.globalInfo.BattlecriesTriggeredThisGame = hero.globalInfo.BattlecriesTriggeredThisGame ?? 0;\r\n\thero.globalInfo.DeathrattlesTriggeredThisGame = hero.globalInfo.DeathrattlesTriggeredThisGame ?? 0;\r\n\thero.globalInfo.BeetleAttackBuff = hero.globalInfo.BeetleAttackBuff ?? 0;\r\n\thero.globalInfo.BeetleHealthBuff = hero.globalInfo.BeetleHealthBuff ?? 0;\r\n\thero.globalInfo.ElementalAttackBuff = hero.globalInfo.ElementalAttackBuff ?? 0;\r\n\thero.globalInfo.ElementalHealthBuff = hero.globalInfo.ElementalHealthBuff ?? 0;\r\n\thero.globalInfo.PirateAttackBuff = hero.globalInfo.PirateAttackBuff ?? 0;\r\n\thero.globalInfo.PirateHealthBuff = hero.globalInfo.PirateHealthBuff ?? 0;\r\n\thero.globalInfo.TavernSpellAttackBuff = hero.globalInfo.TavernSpellAttackBuff ?? 0;\r\n\thero.globalInfo.TavernSpellHealthBuff = hero.globalInfo.TavernSpellHealthBuff ?? 0;\r\n\thero.globalInfo.MutatedLasherAttackBuff = hero.globalInfo.MutatedLasherAttackBuff ?? 0;\r\n\thero.globalInfo.MutatedLasherHealthBuff = hero.globalInfo.MutatedLasherHealthBuff ?? 0;\r\n\thero.globalInfo.TavernSpellsCastThisGame = hero.globalInfo.TavernSpellsCastThisGame ?? 0;\r\n\thero.globalInfo.TavernSpellsCastThisTurn = hero.globalInfo.TavernSpellsCastThisTurn ?? 0;\r\n\thero.globalInfo.CardsPlayedThisTurn = hero.globalInfo.CardsPlayedThisTurn ?? 0;\r\n\thero.globalInfo.MrrgltonsPlayedThisGame = hero.globalInfo.MrrgltonsPlayedThisGame ?? 0;\r\n\thero.globalInfo.AdditionalAttack = hero.globalInfo.AdditionalAttack ?? 0;\r\n\thero.globalInfo.SpellsCastThisGame = hero.globalInfo.SpellsCastThisGame ?? 0;\r\n\thero.globalInfo.UndeadAttackBonus = hero.globalInfo.UndeadAttackBonus ?? 0;\r\n\thero.globalInfo.UndeadHealthBonus = hero.globalInfo.UndeadHealthBonus ?? 0;\r\n\thero.globalInfo.HauntedCarapaceAttackBonus = hero.globalInfo.HauntedCarapaceAttackBonus ?? 0;\r\n\thero.globalInfo.HauntedCarapaceHealthBonus = hero.globalInfo.HauntedCarapaceHealthBonus ?? 0;\r\n\thero.globalInfo.FrostlingBonus = hero.globalInfo.FrostlingBonus ?? 0;\r\n\thero.globalInfo.BloodGemAttackBonus =\r\n\t\t(hero.globalInfo.BloodGemAttackBonus ?? 0) +\r\n\t\t// Not sure why, but this isn't reflected in the player enchant\r\n\t\t(hero.questRewardEntities?.filter((e) => e.cardId === CardIds.EndlessBloodMoon).length ?? 0);\r\n\thero.globalInfo.BloodGemHealthBonus =\r\n\t\t(hero.globalInfo.BloodGemHealthBonus ?? 0) +\r\n\t\t(hero.questRewardEntities?.filter((e) => e.cardId === CardIds.EndlessBloodMoon).length ?? 0);\r\n\thero.globalInfo.GoldrinnBuffAtk = hero.globalInfo.GoldrinnBuffAtk ?? 0;\r\n\thero.globalInfo.GoldrinnBuffHealth = hero.globalInfo.GoldrinnBuffHealth ?? 0;\r\n\thero.globalInfo.WhelpAttackBuff = hero.globalInfo.WhelpAttackBuff ?? 0;\r\n\thero.globalInfo.WhelpHealthBuff = hero.globalInfo.WhelpHealthBuff ?? 0;\r\n\thero.globalInfo.GoldSpentThisGame = hero.globalInfo.GoldSpentThisGame ?? 0;\r\n\thero.globalInfo.VolumizerAttackBuff = hero.globalInfo.VolumizerAttackBuff ?? 0;\r\n\thero.globalInfo.VolumizerHealthBuff = hero.globalInfo.VolumizerHealthBuff ?? 0;\r\n\thero.globalInfo.DeepBluesPlayed = hero.globalInfo.DeepBluesPlayed ?? 0;\r\n\thero.globalInfo.GoldenMinionsPlayedThisGame = hero.globalInfo.GoldenMinionsPlayedThisGame ?? 0;\r\n\thero.globalInfo.DeathrattlesTriggeredThisGame = hero.globalInfo.DeathrattlesTriggeredThisGame ?? 0;\r\n\thero.globalInfo.BackToBackCastThisGame = hero.globalInfo.BackToBackCastThisGame ?? 0;\r\n\thero.globalInfo.TavernSpellsCastThisTurn = hero.globalInfo.TavernSpellsCastThisTurn ?? 0;\r\n\thero.globalInfo.CardsPlayedThisTurn = hero.globalInfo.CardsPlayedThisTurn ?? 0;\r\n\thero.globalInfo.MrrgltonsPlayedThisGame = hero.globalInfo.MrrgltonsPlayedThisGame ?? 0;\r\n\thero.globalInfo.TastyLobstersBuff = hero.globalInfo.TastyLobstersBuff ?? 0;\r\n\t// For some reason the info was not transmitted correctly, so we take the highest value\r\n\t// from the board entities\r\n\t// Won't be totally exact if the value is odd, but should be close enough for a fallback\r\n\tif (hero.globalInfo.TastyLobstersBuff === 0) {\r\n\t\thero.globalInfo.TastyLobstersBuff = board\r\n\t\t\t.filter((e) => e.cardId === CardIds.TastyLobster_BG36_202 || e.cardId === CardIds.TastyLobster_BG36_202_G)\r\n\t\t\t.map((e) => {\r\n\t\t\t\t// Script has total buff, while global info has additional buff\r\n\t\t\t\tconst rawScript = e.scriptDataNum1 ? e.scriptDataNum1 - 1 : 0;\r\n\t\t\t\tconst baseValue = e.cardId === CardIds.TastyLobster_BG36_202 ? rawScript : rawScript / 2;\r\n\t\t\t\treturn baseValue;\r\n\t\t\t})\r\n\t\t\t.reduce((max, value) => Math.max(max, value), 0);\r\n\t}\r\n};\r\n\r\nexport const clearStealthIfNeeded = (\r\n\tboard: BoardEntity[],\r\n\thero: BgsPlayerEntity,\r\n\totherBoard: BoardEntity[],\r\n\totherHero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\t// https://twitter.com/DCalkosz/status/1562194944688660481?s=20&t=100I8IVZmBKgYQWkdK8nIA\r\n\tif (board.every((entity) => entity.stealth && !entity.attack)) {\r\n\t\tboard.forEach((e) => updateStealth(e, false, board, hero, otherHero, gameState));\r\n\t}\r\n\tif (otherBoard.every((entity) => entity.stealth && !entity.attack)) {\r\n\t\totherBoard.forEach((e) => updateStealth(e, false, otherBoard, otherHero, hero, gameState));\r\n\t}\r\n\tif (board.every((e) => e.stealth) && otherBoard.every((e) => e.stealth)) {\r\n\t\tboard.forEach((e) => updateStealth(e, false, board, hero, otherHero, gameState));\r\n\t\totherBoard.forEach((e) => updateStealth(e, false, otherBoard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C,EAAE,EAAE,CAAC,IAAA,uBAAa,EAAC,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC;KAC3F;IACD,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE;QACxE,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAA,uBAAa,EAAC,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC,CAAC;QACjF,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAA,uBAAa,EAAC,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC;KAC3F;AACF,CAAC,CAAC;AAlBW,QAAA,oBAAoB,wBAkB/B","sourcesContent":["/* eslint-disable @typescript-eslint/no-use-before-define */\r\nimport { AllCardsService, Race } from '@firestone-hs/reference-data';\r\nimport { BgsPlayerEntity } from '../bgs-player-entity';\r\nimport { BoardEntity } from '../board-entity';\r\nimport { CardsData } from '../cards/cards-data';\r\nimport { lobsterBaseAttackBuff, lobsterBaseHealthBuff } from '../cards/impl/minion/tasty-lobster';\r\nimport { updateStealth } from '../keywords/stealth';\r\nimport { CardIds } from '../services/card-ids';\r\nimport { addImpliedMechanics, hasCorrectTribe } from '../utils';\r\nimport { FullGameState } from './internal-game-state';\r\n\r\nexport const setMissingAuras = (\r\n\tboard: BoardEntity[],\r\n\tboardHero: BgsPlayerEntity,\r\n\tanomalies: readonly string[],\r\n\tallCards: AllCardsService,\r\n): void => {\r\n\tsetMissingMinionsAura(board, boardHero, anomalies, allCards);\r\n\tsetMissingHeroPowerAura(board, boardHero);\r\n\tsetMissingTrinketAura(board, boardHero);\r\n};\r\n\r\nexport const setMissingTrinketAura = (board: BoardEntity[], boardHero: BgsPlayerEntity): void => {\r\n\tfor (const trinket of boardHero.trinkets ?? []) {\r\n\t\t// switch (trinket.cardId) {\r\n\t\t// \tcase CardIds.WindrunnerNecklace_BG30_MagicItem_997:\r\n\t\t// \tcase CardIds.WindrunnerNecklace_WindrunnerNecklaceToken_BG30_MagicItem_997t:\r\n\t\t// \t\tconst enchantment =\r\n\t\t// \t\t\ttrinket.cardId === CardIds.WindrunnerNecklace_BG30_MagicItem_997\r\n\t\t// \t\t\t\t? CardIds.WindrunnerNecklace_RunningLikeTheWindEnchantment_BG30_MagicItem_997e\r\n\t\t// \t\t\t\t: CardIds.WindrunnerNecklace_RunningLikeTheWindEnchantment_BG30_MagicItem_997e2;\r\n\t\t// \t\tconst buff = trinket.cardId === CardIds.WindrunnerNecklace_BG30_MagicItem_997 ? 8 : 20;\r\n\t\t// \t\tconst target = board[0];\r\n\t\t// \t\tif (!!target && !target.enchantments?.find((e) => e.cardId === enchantment)) {\r\n\t\t// \t\t\ttarget.attack += buff;\r\n\t\t// \t\t\ttarget.enchantments.push({\r\n\t\t// \t\t\t\tcardId: enchantment,\r\n\t\t// \t\t\t\toriginEntityId: trinket.entityId,\r\n\t\t// \t\t\t\ttiming: 0,\r\n\t\t// \t\t\t});\r\n\t\t// \t\t}\r\n\t\t// \t\tbreak;\r\n\t\t// }\r\n\t}\r\n};\r\n\r\nexport const setMissingHeroPowerAura = (board: BoardEntity[], boardHero: BgsPlayerEntity): void => {\r\n\tfor (const heroPower of boardHero.heroPowers) {\r\n\t\tif (heroPower.cardId === CardIds.TheSmokingGun) {\r\n\t\t\tboard\r\n\t\t\t\t.filter(\r\n\t\t\t\t\t(e) =>\r\n\t\t\t\t\t\t!e.enchantments.find(\r\n\t\t\t\t\t\t\t(ench) => ench.cardId === CardIds.TheSmokingGun_ArmedAndStillSmokingEnchantment,\r\n\t\t\t\t\t\t),\r\n\t\t\t\t)\r\n\t\t\t\t.forEach((e) => {\r\n\t\t\t\t\te.attack += 4;\r\n\t\t\t\t});\r\n\t\t}\r\n\t\tif (heroPower.cardId === CardIds.VolatileVenom) {\r\n\t\t\tboard\r\n\t\t\t\t.filter(\r\n\t\t\t\t\t(e) => !e.enchantments.find((ench) => ench.cardId === CardIds.VolatileVenom_VolatileEnchantment),\r\n\t\t\t\t)\r\n\t\t\t\t.forEach((e) => {\r\n\t\t\t\t\te.attack += 7;\r\n\t\t\t\t\te.health += 7;\r\n\t\t\t\t\te.enchantments.push({\r\n\t\t\t\t\t\tcardId: CardIds.VolatileVenom_VolatileEnchantment,\r\n\t\t\t\t\t\toriginEntityId: undefined,\r\n\t\t\t\t\t\ttiming: 0,\r\n\t\t\t\t\t});\r\n\t\t\t\t});\r\n\t\t}\r\n\t}\r\n};\r\n\r\nconst setMissingMinionsAura = (\r\n\tboard: BoardEntity[],\r\n\tboardHero: BgsPlayerEntity,\r\n\tanomalies: readonly string[],\r\n\tallCards: AllCardsService,\r\n): void => {\r\n\tconst pirates: BoardEntity[] = [];\r\n\tconst murlocs: BoardEntity[] = [];\r\n\tconst undead: BoardEntity[] = [];\r\n\tconst divineShielded: BoardEntity[] = [];\r\n\tfor (const e of board) {\r\n\t\tif (e.divineShield) {\r\n\t\t\tdivineShielded.push(e);\r\n\t\t}\r\n\t\tif (hasCorrectTribe(e, boardHero, Race.PIRATE, anomalies, allCards)) {\r\n\t\t\tpirates.push(e);\r\n\t\t}\r\n\t\tif (hasCorrectTribe(e, boardHero, Race.MURLOC, anomalies, allCards)) {\r\n\t\t\tmurlocs.push(e);\r\n\t\t}\r\n\t\tif (hasCorrectTribe(e, boardHero, Race.UNDEAD, anomalies, allCards)) {\r\n\t\t\tundead.push(e);\r\n\t\t}\r\n\t}\r\n\tsetMissingAura(\r\n\t\tpirates,\r\n\t\tCardIds.SouthseaCaptainLegacy_BG_NEW1_027,\r\n\t\tCardIds.SouthseaCaptain_YarrrVanillaEnchantment,\r\n\t\t1,\r\n\t\t1,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tpirates,\r\n\t\tCardIds.SouthseaCaptainLegacy_TB_BaconUps_136,\r\n\t\tCardIds.SouthseaCaptain_YarrrEnchantment,\r\n\t\t2,\r\n\t\t2,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tmurlocs,\r\n\t\tCardIds.MurlocWarleaderLegacy_BG_EX1_507,\r\n\t\tCardIds.MurlocWarleader_MrgglaarglLegacyEnchantment,\r\n\t\t2,\r\n\t\t0,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tdivineShielded,\r\n\t\tCardIds.CyborgDrake_BG25_043,\r\n\t\tCardIds.CyborgDrake_CyborgEnhancementEnchantment_BG25_043e,\r\n\t\t6,\r\n\t\t0,\r\n\t\tfalse,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tundead,\r\n\t\tCardIds.SoreLoser_BG27_030,\r\n\t\tCardIds.SoreLoser_NoImWinningEnchantment_BG27_030e,\r\n\t\tboardHero.tavernTier,\r\n\t\t0,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tundead,\r\n\t\tCardIds.SoreLoser_BG27_030_G,\r\n\t\tCardIds.SoreLoser_NoImWinningEnchantment_BG27_030e,\r\n\t\t2 * boardHero.tavernTier,\r\n\t\t0,\r\n\t);\r\n};\r\n\r\nconst setMissingAura = (\r\n\tboard: BoardEntity[],\r\n\tminionCardId: string,\r\n\tenchantmentCardId: string,\r\n\tattack: number,\r\n\thealth: number,\r\n\tignoreSelf = true,\r\n\tallCards: AllCardsService = null,\r\n): void => {\r\n\tconst buffers = board.filter((e) => e.cardId === minionCardId);\r\n\tfor (const buffer of buffers) {\r\n\t\tboard\r\n\t\t\t.filter((e) => !e.enchantments.find((ench) => ench.cardId === enchantmentCardId))\r\n\t\t\t.filter((e) => (ignoreSelf ? e.entityId !== buffer.entityId : true))\r\n\t\t\t.forEach((e) => {\r\n\t\t\t\te.attack += attack;\r\n\t\t\t\te.health += health;\r\n\t\t\t});\r\n\t}\r\n};\r\n\r\nexport const setImplicitDataHero = (\r\n\thero: BgsPlayerEntity,\r\n\tboard: BoardEntity[],\r\n\tcardsData: CardsData,\r\n\tisPlayer: boolean,\r\n\tentityIdContainer: { entityId: number },\r\n): void => {\r\n\tfor (const heroPower of hero.heroPowers) {\r\n\t\tconst avengeValue = cardsData.avengeValue(heroPower.cardId);\r\n\t\tif (avengeValue > 0) {\r\n\t\t\theroPower.avengeCurrent = avengeValue - (heroPower.scoreValue2 ?? 0);\r\n\t\t\theroPower.avengeDefault = avengeValue;\r\n\t\t}\r\n\t\tif ((heroPower.info as BoardEntity)?.health) {\r\n\t\t\taddImpliedMechanics(heroPower.info as BoardEntity, cardsData);\r\n\t\t}\r\n\t}\r\n\t// Backward compatibility\r\n\tif (!!hero.questRewards?.length && !Array.isArray(hero.questRewards)) {\r\n\t\thero.questRewards = [hero.questRewards as any];\r\n\t}\r\n\r\n\t// Because Denathrius can send a quest reward as its hero power (I think)\r\n\t// For now deactivating this, until I have a scenario where this matters. It feels like\r\n\t// this should be a display issue only, as quest rewards are also handled in the code\r\n\tconst heroPowerAsReward = null; // hero.cardId === CardIds.SireDenathrius_BG24_HERO_100 ? hero.heroPowers[0]?.cardId : null;\r\n\thero.questRewards = [...(hero.questRewards ?? []), heroPowerAsReward].filter((e) => !!e);\r\n\thero.questRewardEntities = hero.questRewardEntities\r\n\t\t? hero.questRewardEntities.map((reward: any) => ({\r\n\t\t\t\tcardId: reward.CardId,\r\n\t\t\t\tscriptDataNum1: reward.ScriptDataNum1 ?? 0,\r\n\t\t\t\tentityId: entityIdContainer.entityId--,\r\n\t\t\t\tavengeDefault: cardsData.avengeValue(reward.CardId),\r\n\t\t\t\tavengeCurrent: cardsData.avengeValue(reward.CardId),\r\n\t\t }))\r\n\t\t: hero.questRewards.map((reward) => ({\r\n\t\t\t\tcardId: reward,\r\n\t\t\t\tentityId: entityIdContainer.entityId--,\r\n\t\t\t\tavengeCurrent: cardsData.avengeValue(reward),\r\n\t\t\t\tavengeDefault: cardsData.avengeValue(reward),\r\n\t\t\t\tscriptDataNum1: cardsData.defaultScriptDataNum(reward),\r\n\t\t }));\r\n\thero.trinkets = (hero.trinkets ?? [])\r\n\t\t.map((trinket) => ({\r\n\t\t\t...trinket,\r\n\t\t\tavengeDefault: cardsData.avengeValue(trinket.cardId),\r\n\t\t\tavengeCurrent: cardsData.avengeValue(trinket.cardId),\r\n\t\t\t// Use scriptDataNum1 to keep the info from the input\r\n\t\t\t// We don't want to use the default value is the value from the game state is 0\r\n\t\t\t// In that case, we probably want to use the ChargesLeft mechanism\r\n\t\t\tscriptDataNum1: trinket.scriptDataNum1 ?? cardsData.defaultScriptDataNum(trinket.cardId),\r\n\t\t}))\r\n\t\t.sort((a, b) => a.entityId - b.entityId);\r\n\t// 0 is not a valid entityId\r\n\thero.entityId = hero.entityId || entityIdContainer.entityId--;\r\n\thero.hand = hero.hand ?? [];\r\n\thero.enchantments = hero.enchantments ?? [];\r\n\tif (!hero.globalInfo) {\r\n\t\thero.globalInfo = {};\r\n\t}\r\n\r\n\thero.globalInfo.PirateAttackBonus = hero.globalInfo.PirateAttackBonus ?? 0;\r\n\thero.globalInfo.MechAttackBonus = hero.globalInfo.MechAttackBonus ?? 0;\r\n\thero.globalInfo.EternalKnightsDeadThisGame = hero.globalInfo.EternalKnightsDeadThisGame ?? 0;\r\n\thero.globalInfo.EternalKnightAttackBuff = hero.globalInfo.EternalKnightAttackBuff ?? 0;\r\n\thero.globalInfo.EternalKnightHealthBuff = hero.globalInfo.EternalKnightHealthBuff ?? 0;\r\n\thero.globalInfo.SanlaynScribesDeadThisGame = hero.globalInfo.SanlaynScribesDeadThisGame ?? 0;\r\n\thero.globalInfo.BeastsSummonedThisGame = hero.globalInfo.BeastsSummonedThisGame ?? 0;\r\n\thero.globalInfo.BeastsSummonedThisCombat = hero.globalInfo.BeastsSummonedThisCombat ?? 0;\r\n\thero.globalInfo.MagnetizedThisGame = hero.globalInfo.MagnetizedThisGame ?? 0;\r\n\thero.globalInfo.PiratesSummonedThisGame = hero.globalInfo.PiratesSummonedThisGame ?? 0;\r\n\thero.globalInfo.AstralAutomatonsSummonedThisGame = hero.globalInfo.AstralAutomatonsSummonedThisGame ?? 0;\r\n\thero.globalInfo.BattlecriesTriggeredThisGame = hero.globalInfo.BattlecriesTriggeredThisGame ?? 0;\r\n\thero.globalInfo.DeathrattlesTriggeredThisGame = hero.globalInfo.DeathrattlesTriggeredThisGame ?? 0;\r\n\thero.globalInfo.BeetleAttackBuff = hero.globalInfo.BeetleAttackBuff ?? 0;\r\n\thero.globalInfo.BeetleHealthBuff = hero.globalInfo.BeetleHealthBuff ?? 0;\r\n\thero.globalInfo.ElementalAttackBuff = hero.globalInfo.ElementalAttackBuff ?? 0;\r\n\thero.globalInfo.ElementalHealthBuff = hero.globalInfo.ElementalHealthBuff ?? 0;\r\n\thero.globalInfo.PirateAttackBuff = hero.globalInfo.PirateAttackBuff ?? 0;\r\n\thero.globalInfo.PirateHealthBuff = hero.globalInfo.PirateHealthBuff ?? 0;\r\n\thero.globalInfo.TavernSpellAttackBuff = hero.globalInfo.TavernSpellAttackBuff ?? 0;\r\n\thero.globalInfo.TavernSpellHealthBuff = hero.globalInfo.TavernSpellHealthBuff ?? 0;\r\n\thero.globalInfo.MutatedLasherAttackBuff = hero.globalInfo.MutatedLasherAttackBuff ?? 0;\r\n\thero.globalInfo.MutatedLasherHealthBuff = hero.globalInfo.MutatedLasherHealthBuff ?? 0;\r\n\thero.globalInfo.TavernSpellsCastThisGame = hero.globalInfo.TavernSpellsCastThisGame ?? 0;\r\n\thero.globalInfo.TavernSpellsCastThisTurn = hero.globalInfo.TavernSpellsCastThisTurn ?? 0;\r\n\thero.globalInfo.CardsPlayedThisTurn = hero.globalInfo.CardsPlayedThisTurn ?? 0;\r\n\thero.globalInfo.MrrgltonsPlayedThisGame = hero.globalInfo.MrrgltonsPlayedThisGame ?? 0;\r\n\thero.globalInfo.AdditionalAttack = hero.globalInfo.AdditionalAttack ?? 0;\r\n\thero.globalInfo.SpellsCastThisGame = hero.globalInfo.SpellsCastThisGame ?? 0;\r\n\thero.globalInfo.UndeadAttackBonus = hero.globalInfo.UndeadAttackBonus ?? 0;\r\n\thero.globalInfo.UndeadHealthBonus = hero.globalInfo.UndeadHealthBonus ?? 0;\r\n\thero.globalInfo.HauntedCarapaceAttackBonus = hero.globalInfo.HauntedCarapaceAttackBonus ?? 0;\r\n\thero.globalInfo.HauntedCarapaceHealthBonus = hero.globalInfo.HauntedCarapaceHealthBonus ?? 0;\r\n\thero.globalInfo.FrostlingBonus = hero.globalInfo.FrostlingBonus ?? 0;\r\n\thero.globalInfo.BloodGemAttackBonus =\r\n\t\t(hero.globalInfo.BloodGemAttackBonus ?? 0) +\r\n\t\t// Not sure why, but this isn't reflected in the player enchant\r\n\t\t(hero.questRewardEntities?.filter((e) => e.cardId === CardIds.EndlessBloodMoon).length ?? 0);\r\n\thero.globalInfo.BloodGemHealthBonus =\r\n\t\t(hero.globalInfo.BloodGemHealthBonus ?? 0) +\r\n\t\t(hero.questRewardEntities?.filter((e) => e.cardId === CardIds.EndlessBloodMoon).length ?? 0);\r\n\thero.globalInfo.GoldrinnBuffAtk = hero.globalInfo.GoldrinnBuffAtk ?? 0;\r\n\thero.globalInfo.GoldrinnBuffHealth = hero.globalInfo.GoldrinnBuffHealth ?? 0;\r\n\thero.globalInfo.WhelpAttackBuff = hero.globalInfo.WhelpAttackBuff ?? 0;\r\n\thero.globalInfo.WhelpHealthBuff = hero.globalInfo.WhelpHealthBuff ?? 0;\r\n\thero.globalInfo.GoldSpentThisGame = hero.globalInfo.GoldSpentThisGame ?? 0;\r\n\thero.globalInfo.VolumizerAttackBuff = hero.globalInfo.VolumizerAttackBuff ?? 0;\r\n\thero.globalInfo.VolumizerHealthBuff = hero.globalInfo.VolumizerHealthBuff ?? 0;\r\n\thero.globalInfo.DeepBluesPlayed = hero.globalInfo.DeepBluesPlayed ?? 0;\r\n\thero.globalInfo.GoldenMinionsPlayedThisGame = hero.globalInfo.GoldenMinionsPlayedThisGame ?? 0;\r\n\thero.globalInfo.DeathrattlesTriggeredThisGame = hero.globalInfo.DeathrattlesTriggeredThisGame ?? 0;\r\n\thero.globalInfo.BackToBackCastThisGame = hero.globalInfo.BackToBackCastThisGame ?? 0;\r\n\thero.globalInfo.TavernSpellsCastThisTurn = hero.globalInfo.TavernSpellsCastThisTurn ?? 0;\r\n\thero.globalInfo.CardsPlayedThisTurn = hero.globalInfo.CardsPlayedThisTurn ?? 0;\r\n\thero.globalInfo.MrrgltonsPlayedThisGame = hero.globalInfo.MrrgltonsPlayedThisGame ?? 0;\r\n\thero.globalInfo.TastyLobstersBuff = hero.globalInfo.TastyLobstersBuff ?? 0;\r\n\t// For some reason the info was not transmitted correctly, so we take the highest value\r\n\t// from the board entities\r\n\t// Won't be totally exact if the value is odd, but should be close enough for a fallback\r\n\tif (hero.globalInfo.TastyLobstersBuff === 0) {\r\n\t\thero.globalInfo.TastyLobstersBuff = board\r\n\t\t\t.filter((e) => e.cardId === CardIds.TastyLobster_BG36_202 || e.cardId === CardIds.TastyLobster_BG36_202_G)\r\n\t\t\t.map((e) => {\r\n\t\t\t\t// Script has total buff, while global info has additional buff\r\n\t\t\t\tconst rawScriptAtk = e.scriptDataNum1 ? e.scriptDataNum1 / lobsterBaseAttackBuff - 1 : 0;\r\n\t\t\t\tconst rawScriptHealth = e.scriptDataNum2 ? e.scriptDataNum2 / lobsterBaseHealthBuff - 1 : 0;\r\n\t\t\t\tconst rawScript = Math.max(rawScriptAtk, rawScriptHealth);\r\n\t\t\t\tconst baseValue = e.cardId === CardIds.TastyLobster_BG36_202 ? rawScript : rawScript / 2;\r\n\t\t\t\treturn baseValue;\r\n\t\t\t})\r\n\t\t\t.reduce((max, value) => Math.max(max, value), 0);\r\n\t}\r\n};\r\n\r\nexport const clearStealthIfNeeded = (\r\n\tboard: BoardEntity[],\r\n\thero: BgsPlayerEntity,\r\n\totherBoard: BoardEntity[],\r\n\totherHero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\t// https://twitter.com/DCalkosz/status/1562194944688660481?s=20&t=100I8IVZmBKgYQWkdK8nIA\r\n\tif (board.every((entity) => entity.stealth && !entity.attack)) {\r\n\t\tboard.forEach((e) => updateStealth(e, false, board, hero, otherHero, gameState));\r\n\t}\r\n\tif (otherBoard.every((entity) => entity.stealth && !entity.attack)) {\r\n\t\totherBoard.forEach((e) => updateStealth(e, false, otherBoard, otherHero, hero, gameState));\r\n\t}\r\n\tif (board.every((e) => e.stealth) && otherBoard.every((e) => e.stealth)) {\r\n\t\tboard.forEach((e) => updateStealth(e, false, board, hero, otherHero, gameState));\r\n\t\totherBoard.forEach((e) => updateStealth(e, false, otherBoard, otherHero, hero, gameState));\r\n\t}\r\n};\r\n"]}
|
|
@@ -99,6 +99,17 @@ const updateTavernSpellsCastThisGame = (source, board, hero, amount, gameState)
|
|
|
99
99
|
gameState: gameState,
|
|
100
100
|
});
|
|
101
101
|
}
|
|
102
|
+
for (const enchantment of entity.enchantments) {
|
|
103
|
+
const cardImpl = _card_mappings_1.cardMappings[enchantment.cardId];
|
|
104
|
+
if ((0, card_interface_1.hasOnGlobalInfoUpdatedEnchantment)(cardImpl)) {
|
|
105
|
+
cardImpl.onGlobalInfoUpdatedEnchantment(entity, enchantment, {
|
|
106
|
+
values: [{ type: 'TavernSpellsCastThisGame', oldValue: previousValue, newValue: newValue }],
|
|
107
|
+
hero: hero,
|
|
108
|
+
board: board,
|
|
109
|
+
gameState: gameState,
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
}
|
|
102
113
|
}
|
|
103
114
|
};
|
|
104
115
|
exports.updateTavernSpellsCastThisGame = updateTavernSpellsCastThisGame;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"global-info-helpers.js","sourceRoot":"","sources":["../../src/simulation/global-info-helpers.ts"],"names":[],"mappings":";;;AAAA,iEAAoD;AAI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;gBACpC,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,0BAA0B,EAAE,QAAQ,EAAE,aAAa,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC;gBAC3F,IAAI,EAAE,IAAI;gBACV,KAAK,EAAE,KAAK;gBACZ,SAAS,EAAE,SAAS;aACpB,CAAC,CAAC;SACH;KACD;AACF,CAAC,CAAC;AArBW,QAAA,8BAA8B,kCAqBzC","sourcesContent":["import { Race } from '@firestone-hs/reference-data';\r\nimport { BgsPlayerEntity } from '../bgs-player-entity';\r\nimport { BoardEntity } from '../board-entity';\r\nimport { BoardSecret } from '../board-secret';\r\nimport { hasOnGlobalInfoUpdated } from '../cards/card.interface';\r\nimport { isWhelp } from '../cards/cards-data';\r\nimport { cardMappings } from '../cards/impl/_card-mappings';\r\nimport { addStatsToBoard } from '../utils';\r\nimport { FullGameState } from './internal-game-state';\r\nimport { modifyStats } from './stats';\r\n\r\nexport const increaseUndeadAttackBonus = (\r\n\tsource: BoardEntity | BgsPlayerEntity | BoardSecret,\r\n\tboard: BoardEntity[],\r\n\thero: BgsPlayerEntity,\r\n\tamount: number,\r\n\tgameState: FullGameState,\r\n\t// 2026-04-25 Amalgam getting buffed also boosts Mishmash\r\n\t// https://replays.firestoneapp.com/?reviewId=845efb54-f37d-4cb7-9947-cc72fc12d800&turn=19&action=3\r\n\tcountsAsStatsGain = true,\r\n): void => {\r\n\thero.globalInfo.UndeadAttackBonus = (hero.globalInfo.UndeadAttackBonus ?? 0) + amount;\r\n\taddStatsToBoard(source, board, hero, amount, 0, gameState, Race[Race.UNDEAD], countsAsStatsGain);\r\n};\r\n\r\nexport const increaseUndeadHealthBonus = (\r\n\tsource: BoardEntity | BgsPlayerEntity | BoardSecret,\r\n\tboard: BoardEntity[],\r\n\thero: BgsPlayerEntity,\r\n\tamount: number,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\thero.globalInfo.UndeadHealthBonus = (hero.globalInfo.UndeadHealthBonus ?? 0) + amount;\r\n\taddStatsToBoard(source, board, hero, 0, amount, gameState, Race[Race.UNDEAD], false);\r\n};\r\n\r\nexport const increasePirateAttackBonus = (\r\n\tsource: BoardEntity | BgsPlayerEntity | BoardSecret,\r\n\tboard: BoardEntity[],\r\n\thero: BgsPlayerEntity,\r\n\tamount: number,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\thero.globalInfo.PirateAttackBonus = (hero.globalInfo.PirateAttackBonus ?? 0) + amount;\r\n\taddStatsToBoard(source, board, hero, amount, 0, gameState, Race[Race.PIRATE], false);\r\n};\r\n\r\nexport const increaseMechAttackBonus = (\r\n\tsource: BoardEntity | BgsPlayerEntity | BoardSecret,\r\n\tboard: BoardEntity[],\r\n\thero: BgsPlayerEntity,\r\n\tamount: number,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\thero.globalInfo.MechAttackBonus = (hero.globalInfo.MechAttackBonus ?? 0) + amount;\r\n\taddStatsToBoard(source, board, hero, amount, 0, gameState, Race[Race.MECH], false);\r\n};\r\n\r\nexport const increaseGoldrinnBuff = (\r\n\tsource: BoardEntity | BgsPlayerEntity | BoardSecret,\r\n\tboard: BoardEntity[],\r\n\thero: BgsPlayerEntity,\r\n\tattack: number,\r\n\thealth: number,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\thero.globalInfo.GoldrinnBuffAtk = (hero.globalInfo.GoldrinnBuffAtk ?? 0) + attack;\r\n\thero.globalInfo.GoldrinnBuffHealth = (hero.globalInfo.GoldrinnBuffHealth ?? 0) + health;\r\n\taddStatsToBoard(source, board, hero, attack, health, gameState, Race[Race.BEAST]);\r\n};\r\n\r\nexport const increaseWhelpBuff = (\r\n\tsource: BoardEntity | BgsPlayerEntity | BoardSecret,\r\n\tboard: BoardEntity[],\r\n\thero: BgsPlayerEntity,\r\n\tattack: number,\r\n\thealth: number,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\thero.globalInfo.WhelpAttackBuff = (hero.globalInfo.WhelpAttackBuff ?? 0) + attack;\r\n\thero.globalInfo.WhelpHealthBuff = (hero.globalInfo.WhelpHealthBuff ?? 0) + health;\r\n\tconst targets = board.filter((entity) => isWhelp(entity.cardId, gameState.allCards));\r\n\ttargets.forEach((target) => {\r\n\t\tmodifyStats(target, target, attack, health, board, hero, gameState, false);\r\n\t});\r\n};\r\n\r\nexport const updateElementalStatsBuff = (\r\n\tsource: BoardEntity | BgsPlayerEntity | BoardSecret,\r\n\tboard: BoardEntity[],\r\n\thero: BgsPlayerEntity,\r\n\tattack: number,\r\n\thealth: number,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\tconst previousAttackValue = hero.globalInfo.ElementalAttackBuff ?? 0;\r\n\tconst previousHealthValue = hero.globalInfo.ElementalHealthBuff ?? 0;\r\n\tconst newAttackValue = previousAttackValue + attack;\r\n\tconst newHealthValue = previousHealthValue + health;\r\n\thero.globalInfo.ElementalAttackBuff = newAttackValue;\r\n\thero.globalInfo.ElementalHealthBuff = newHealthValue;\r\n\tfor (const entity of board) {\r\n\t\tconst cardImpl = cardMappings[entity.cardId];\r\n\t\tif (hasOnGlobalInfoUpdated(cardImpl)) {\r\n\t\t\tconst values = [];\r\n\t\t\tif (attack !== 0) {\r\n\t\t\t\tvalues.push({\r\n\t\t\t\t\ttype: 'ElementalAttackBuff',\r\n\t\t\t\t\toldValue: previousAttackValue,\r\n\t\t\t\t\tnewValue: newAttackValue,\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t\tif (health !== 0) {\r\n\t\t\t\tvalues.push({\r\n\t\t\t\t\ttype: 'ElementalHealthBuff',\r\n\t\t\t\t\toldValue: previousHealthValue,\r\n\t\t\t\t\tnewValue: newHealthValue,\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t\tcardImpl.onGlobalInfoUpdated(entity, {\r\n\t\t\t\tvalues: values,\r\n\t\t\t\thero: hero,\r\n\t\t\t\tboard: board,\r\n\t\t\t\tgameState: gameState,\r\n\t\t\t});\r\n\t\t}\r\n\t}\r\n};\r\n\r\nexport const updateTavernSpellsCastThisGame = (\r\n\tsource: BoardEntity | BgsPlayerEntity | BoardSecret,\r\n\tboard: BoardEntity[],\r\n\thero: BgsPlayerEntity,\r\n\tamount: number,\r\n\tgameState: FullGameState,\r\n) => {\r\n\tconst previousValue = hero.globalInfo.TavernSpellsCastThisGame ?? 0;\r\n\tconst newValue = previousValue + amount;\r\n\thero.globalInfo.TavernSpellsCastThisGame = newValue;\r\n\tfor (const entity of board) {\r\n\t\tconst cardImpl = cardMappings[entity.cardId];\r\n\t\tif (hasOnGlobalInfoUpdated(cardImpl)) {\r\n\t\t\tcardImpl.onGlobalInfoUpdated(entity, {\r\n\t\t\t\tvalues: [{ type: 'TavernSpellsCastThisGame', oldValue: previousValue, newValue: newValue }],\r\n\t\t\t\thero: hero,\r\n\t\t\t\tboard: board,\r\n\t\t\t\tgameState: gameState,\r\n\t\t\t});\r\n\t\t}\r\n\t}\r\n};\r\n"]}
|
|
1
|
+
{"version":3,"file":"global-info-helpers.js","sourceRoot":"","sources":["../../src/simulation/global-info-helpers.ts"],"names":[],"mappings":";;;AAAA,iEAAoD;AAIpD,4DAAoG;AACpG,oDAA8C;AAC9C,iEAA4D;AAC5D,oCAA2C;AAE3C,mCAAsC;AAE/B,MAAM,yBAAyB,GAAG,CACxC,MAAmD,EACnD,KAAoB,EACpB,IAAqB,EACrB,MAAc,EACd,SAAwB,EAGxB,iBAAiB,GAAG,IAAI,EACjB,EAAE;;IACT,IAAI,CAAC,UAAU,CAAC,iBAAiB,GAAG,CAAC,MAAA,IAAI,CAAC,UAAU,CAAC,iBAAiB,mCAAI,CAAC,CAAC,GAAG,MAAM,CAAC;IACtF,IAAA,uBAAe,EAAC,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,EAAE,SAAS,EAAE,qBAAI,CAAC,qBAAI,CAAC,MAAM,CAAC,EAAE,iBAAiB,CAAC,CAAC;AAClG,CAAC,CAAC;AAZW,QAAA,yBAAyB,6BAYpC;AAEK,MAAM,yBAAyB,GAA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;oBAC3F,IAAI,EAAE,IAAI;oBACV,KAAK,EAAE,KAAK;oBACZ,SAAS,EAAE,SAAS;iBACpB,CAAC,CAAC;aACH;SACD;KACD;AACF,CAAC,CAAC;AAhCW,QAAA,8BAA8B,kCAgCzC","sourcesContent":["import { Race } from '@firestone-hs/reference-data';\r\nimport { BgsPlayerEntity } from '../bgs-player-entity';\r\nimport { BoardEntity } from '../board-entity';\r\nimport { BoardSecret } from '../board-secret';\r\nimport { hasOnGlobalInfoUpdated, hasOnGlobalInfoUpdatedEnchantment } from '../cards/card.interface';\r\nimport { isWhelp } from '../cards/cards-data';\r\nimport { cardMappings } from '../cards/impl/_card-mappings';\r\nimport { addStatsToBoard } from '../utils';\r\nimport { FullGameState } from './internal-game-state';\r\nimport { modifyStats } from './stats';\r\n\r\nexport const increaseUndeadAttackBonus = (\r\n\tsource: BoardEntity | BgsPlayerEntity | BoardSecret,\r\n\tboard: BoardEntity[],\r\n\thero: BgsPlayerEntity,\r\n\tamount: number,\r\n\tgameState: FullGameState,\r\n\t// 2026-04-25 Amalgam getting buffed also boosts Mishmash\r\n\t// https://replays.firestoneapp.com/?reviewId=845efb54-f37d-4cb7-9947-cc72fc12d800&turn=19&action=3\r\n\tcountsAsStatsGain = true,\r\n): void => {\r\n\thero.globalInfo.UndeadAttackBonus = (hero.globalInfo.UndeadAttackBonus ?? 0) + amount;\r\n\taddStatsToBoard(source, board, hero, amount, 0, gameState, Race[Race.UNDEAD], countsAsStatsGain);\r\n};\r\n\r\nexport const increaseUndeadHealthBonus = (\r\n\tsource: BoardEntity | BgsPlayerEntity | BoardSecret,\r\n\tboard: BoardEntity[],\r\n\thero: BgsPlayerEntity,\r\n\tamount: number,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\thero.globalInfo.UndeadHealthBonus = (hero.globalInfo.UndeadHealthBonus ?? 0) + amount;\r\n\taddStatsToBoard(source, board, hero, 0, amount, gameState, Race[Race.UNDEAD], false);\r\n};\r\n\r\nexport const increasePirateAttackBonus = (\r\n\tsource: BoardEntity | BgsPlayerEntity | BoardSecret,\r\n\tboard: BoardEntity[],\r\n\thero: BgsPlayerEntity,\r\n\tamount: number,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\thero.globalInfo.PirateAttackBonus = (hero.globalInfo.PirateAttackBonus ?? 0) + amount;\r\n\taddStatsToBoard(source, board, hero, amount, 0, gameState, Race[Race.PIRATE], false);\r\n};\r\n\r\nexport const increaseMechAttackBonus = (\r\n\tsource: BoardEntity | BgsPlayerEntity | BoardSecret,\r\n\tboard: BoardEntity[],\r\n\thero: BgsPlayerEntity,\r\n\tamount: number,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\thero.globalInfo.MechAttackBonus = (hero.globalInfo.MechAttackBonus ?? 0) + amount;\r\n\taddStatsToBoard(source, board, hero, amount, 0, gameState, Race[Race.MECH], false);\r\n};\r\n\r\nexport const increaseGoldrinnBuff = (\r\n\tsource: BoardEntity | BgsPlayerEntity | BoardSecret,\r\n\tboard: BoardEntity[],\r\n\thero: BgsPlayerEntity,\r\n\tattack: number,\r\n\thealth: number,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\thero.globalInfo.GoldrinnBuffAtk = (hero.globalInfo.GoldrinnBuffAtk ?? 0) + attack;\r\n\thero.globalInfo.GoldrinnBuffHealth = (hero.globalInfo.GoldrinnBuffHealth ?? 0) + health;\r\n\taddStatsToBoard(source, board, hero, attack, health, gameState, Race[Race.BEAST]);\r\n};\r\n\r\nexport const increaseWhelpBuff = (\r\n\tsource: BoardEntity | BgsPlayerEntity | BoardSecret,\r\n\tboard: BoardEntity[],\r\n\thero: BgsPlayerEntity,\r\n\tattack: number,\r\n\thealth: number,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\thero.globalInfo.WhelpAttackBuff = (hero.globalInfo.WhelpAttackBuff ?? 0) + attack;\r\n\thero.globalInfo.WhelpHealthBuff = (hero.globalInfo.WhelpHealthBuff ?? 0) + health;\r\n\tconst targets = board.filter((entity) => isWhelp(entity.cardId, gameState.allCards));\r\n\ttargets.forEach((target) => {\r\n\t\tmodifyStats(target, target, attack, health, board, hero, gameState, false);\r\n\t});\r\n};\r\n\r\nexport const updateElementalStatsBuff = (\r\n\tsource: BoardEntity | BgsPlayerEntity | BoardSecret,\r\n\tboard: BoardEntity[],\r\n\thero: BgsPlayerEntity,\r\n\tattack: number,\r\n\thealth: number,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\tconst previousAttackValue = hero.globalInfo.ElementalAttackBuff ?? 0;\r\n\tconst previousHealthValue = hero.globalInfo.ElementalHealthBuff ?? 0;\r\n\tconst newAttackValue = previousAttackValue + attack;\r\n\tconst newHealthValue = previousHealthValue + health;\r\n\thero.globalInfo.ElementalAttackBuff = newAttackValue;\r\n\thero.globalInfo.ElementalHealthBuff = newHealthValue;\r\n\tfor (const entity of board) {\r\n\t\tconst cardImpl = cardMappings[entity.cardId];\r\n\t\tif (hasOnGlobalInfoUpdated(cardImpl)) {\r\n\t\t\tconst values = [];\r\n\t\t\tif (attack !== 0) {\r\n\t\t\t\tvalues.push({\r\n\t\t\t\t\ttype: 'ElementalAttackBuff',\r\n\t\t\t\t\toldValue: previousAttackValue,\r\n\t\t\t\t\tnewValue: newAttackValue,\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t\tif (health !== 0) {\r\n\t\t\t\tvalues.push({\r\n\t\t\t\t\ttype: 'ElementalHealthBuff',\r\n\t\t\t\t\toldValue: previousHealthValue,\r\n\t\t\t\t\tnewValue: newHealthValue,\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t\tcardImpl.onGlobalInfoUpdated(entity, {\r\n\t\t\t\tvalues: values,\r\n\t\t\t\thero: hero,\r\n\t\t\t\tboard: board,\r\n\t\t\t\tgameState: gameState,\r\n\t\t\t});\r\n\t\t}\r\n\t}\r\n};\r\n\r\nexport const updateTavernSpellsCastThisGame = (\r\n\tsource: BoardEntity | BgsPlayerEntity | BoardSecret,\r\n\tboard: BoardEntity[],\r\n\thero: BgsPlayerEntity,\r\n\tamount: number,\r\n\tgameState: FullGameState,\r\n) => {\r\n\tconst previousValue = hero.globalInfo.TavernSpellsCastThisGame ?? 0;\r\n\tconst newValue = previousValue + amount;\r\n\thero.globalInfo.TavernSpellsCastThisGame = newValue;\r\n\tfor (const entity of board) {\r\n\t\tconst cardImpl = cardMappings[entity.cardId];\r\n\t\tif (hasOnGlobalInfoUpdated(cardImpl)) {\r\n\t\t\tcardImpl.onGlobalInfoUpdated(entity, {\r\n\t\t\t\tvalues: [{ type: 'TavernSpellsCastThisGame', oldValue: previousValue, newValue: newValue }],\r\n\t\t\t\thero: hero,\r\n\t\t\t\tboard: board,\r\n\t\t\t\tgameState: gameState,\r\n\t\t\t});\r\n\t\t}\r\n\t\tfor (const enchantment of entity.enchantments) {\r\n\t\t\tconst cardImpl = cardMappings[enchantment.cardId];\r\n\t\t\tif (hasOnGlobalInfoUpdatedEnchantment(cardImpl)) {\r\n\t\t\t\tcardImpl.onGlobalInfoUpdatedEnchantment(entity, enchantment, {\r\n\t\t\t\t\tvalues: [{ type: 'TavernSpellsCastThisGame', oldValue: previousValue, newValue: newValue }],\r\n\t\t\t\t\thero: hero,\r\n\t\t\t\t\tboard: board,\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"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BgsPlayerEntity } from '../bgs-player-entity';
|
|
2
2
|
import { BoardEntity } from '../board-entity';
|
|
3
3
|
import { FullGameState } from './internal-game-state';
|
|
4
|
-
export declare const onMinionKill: (killer: BoardEntity, killerIsAttacking: boolean, victim: BoardEntity, killerBoard: BoardEntity[], killerHero: BgsPlayerEntity, victimBoard: BoardEntity[], victimHero: BgsPlayerEntity, defenderNeighbours: readonly BoardEntity[], gameState: FullGameState) => {
|
|
4
|
+
export declare const onMinionKill: (killer: BoardEntity, hadVenomous: boolean, killerIsAttacking: boolean, victim: BoardEntity, killerBoard: BoardEntity[], killerHero: BgsPlayerEntity, victimBoard: BoardEntity[], victimHero: BgsPlayerEntity, defenderNeighbours: readonly BoardEntity[], gameState: FullGameState) => {
|
|
5
5
|
dmgDoneByAttacker: number;
|
|
6
6
|
dmgDoneByDefender: number;
|
|
7
7
|
};
|
|
@@ -6,7 +6,7 @@ const card_interface_1 = require("../cards/card.interface");
|
|
|
6
6
|
const _card_mappings_1 = require("../cards/impl/_card-mappings");
|
|
7
7
|
const utils_1 = require("../services/utils");
|
|
8
8
|
const stats_1 = require("./stats");
|
|
9
|
-
const onMinionKill = (killer, killerIsAttacking, victim, killerBoard, killerHero, victimBoard, victimHero, defenderNeighbours, gameState) => {
|
|
9
|
+
const onMinionKill = (killer, hadVenomous, killerIsAttacking, victim, killerBoard, killerHero, victimBoard, victimHero, defenderNeighbours, gameState) => {
|
|
10
10
|
if (!(killer === null || killer === void 0 ? void 0 : killer.cardId)) {
|
|
11
11
|
return { dmgDoneByAttacker: 0, dmgDoneByDefender: 0 };
|
|
12
12
|
}
|
|
@@ -17,6 +17,7 @@ const onMinionKill = (killer, killerIsAttacking, victim, killerBoard, killerHero
|
|
|
17
17
|
if ((0, card_interface_1.hasOnMinionKilled)(onMinionKilledImpl)) {
|
|
18
18
|
const { dmgDoneByAttacker, dmgDoneByDefender } = onMinionKilledImpl.onMinionKilled(boardEntity, {
|
|
19
19
|
killer: killer,
|
|
20
|
+
hadVenomous,
|
|
20
21
|
killerIsAttacking: killerIsAttacking,
|
|
21
22
|
minionKilled: victim,
|
|
22
23
|
attackingHero: killerHero,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"minion-kill.js","sourceRoot":"","sources":["../../src/simulation/minion-kill.ts"],"names":[],"mappings":";;;AAAA,iEAAwD;AAGxD,4DAA4D;AAC5D,iEAA4D;AAE5D,6CAA+C;AAE/C,mCAAsC;AAE/B,MAAM,YAAY,GAAG,CAC3B,MAAmB,EACnB,iBAA0B,EAC1B,MAAmB,EACnB,WA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,CAAC,CAAC;oBAC9F,IAAA,mBAAW,EACV,sBAAsB,EACtB,MAAM,EACN,0BAA0B,GAAG,MAAM,CAAC,MAAM,EAC1C,0BAA0B,GAAG,MAAM,CAAC,SAAS,EAC7C,WAAW,EACX,UAAU,EACV,SAAS,CACT,CAAC;oBACF,SAAS,CAAC,SAAS,CAAC,mBAAmB,CACtC,MAAM,EACN,sBAAsB,EACtB,WAAW,EACX,UAAU,EACV,UAAU,CACV,CAAC;iBACF;aACD;KACF;IAED,OAAO,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,CAAC;AAC7F,CAAC,CAAC;AAtFW,QAAA,YAAY,gBAsFvB","sourcesContent":["import { CardType } from '@firestone-hs/reference-data';\r\nimport { BgsPlayerEntity } from '../bgs-player-entity';\r\nimport { BoardEntity } from '../board-entity';\r\nimport { hasOnMinionKilled } from '../cards/card.interface';\r\nimport { cardMappings } from '../cards/impl/_card-mappings';\r\nimport { CardIds } from '../services/card-ids';\r\nimport { pickRandom } from '../services/utils';\r\nimport { FullGameState } from './internal-game-state';\r\nimport { modifyStats } from './stats';\r\n\r\nexport const onMinionKill = (\r\n\tkiller: BoardEntity,\r\n\thadVenomous: boolean,\r\n\tkillerIsAttacking: boolean,\r\n\tvictim: BoardEntity,\r\n\tkillerBoard: BoardEntity[],\r\n\tkillerHero: BgsPlayerEntity,\r\n\tvictimBoard: BoardEntity[],\r\n\tvictimHero: BgsPlayerEntity,\r\n\tdefenderNeighbours: readonly BoardEntity[],\r\n\tgameState: FullGameState,\r\n): { dmgDoneByAttacker: number; dmgDoneByDefender: number } => {\r\n\t// Can be null if killed by a hero power for instance\r\n\tif (!killer?.cardId) {\r\n\t\treturn { dmgDoneByAttacker: 0, dmgDoneByDefender: 0 };\r\n\t}\r\n\r\n\tlet damageDoneByAttacker = 0;\r\n\tlet damageDoneByDefender = 0;\r\n\tfor (const boardEntity of killerBoard) {\r\n\t\tconst onMinionKilledImpl = cardMappings[boardEntity.cardId];\r\n\t\tif (hasOnMinionKilled(onMinionKilledImpl)) {\r\n\t\t\tconst { dmgDoneByAttacker, dmgDoneByDefender } = onMinionKilledImpl.onMinionKilled(boardEntity, {\r\n\t\t\t\tkiller: killer,\r\n\t\t\t\thadVenomous,\r\n\t\t\t\tkillerIsAttacking: killerIsAttacking,\r\n\t\t\t\tminionKilled: victim,\r\n\t\t\t\tattackingHero: killerHero,\r\n\t\t\t\tattackingBoard: killerBoard,\r\n\t\t\t\tdefendingHero: victimHero,\r\n\t\t\t\tdefendingBoard: victimBoard,\r\n\t\t\t\tdefenderNeighbours: defenderNeighbours,\r\n\t\t\t\tgameState,\r\n\t\t\t\tplayerIsFriendly: killerHero.friendly,\r\n\t\t\t});\r\n\t\t\tdamageDoneByAttacker += dmgDoneByAttacker;\r\n\t\t\tdamageDoneByDefender += dmgDoneByDefender;\r\n\t\t}\r\n\t}\r\n\r\n\tswitch (killer.cardId) {\r\n\t\tcase CardIds.Mannoroth_BG27_507:\r\n\t\tcase CardIds.Mannoroth_BG27_507_G:\r\n\t\t\tif (killer.health > 0 && !killer.definitelyDead && killer.abiityChargesLeft > 0) {\r\n\t\t\t\tmodifyStats(killer, killer, victim.attack, victim.maxHealth, killerBoard, killerHero, gameState);\r\n\t\t\t\tgameState.spectator.registerPowerTarget(killer, killer, killerBoard, killerHero, victimHero);\r\n\t\t\t\tkiller.abiityChargesLeft--;\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\tcase CardIds.TideOracleMorgl_BG27_513:\r\n\t\tcase CardIds.TideOracleMorgl_BG27_513_G:\r\n\t\t\tif (\r\n\t\t\t\tgameState.sharedState.currentAttackerEntityId != null &&\r\n\t\t\t\tgameState.sharedState.currentAttackerEntityId === killer.entityId\r\n\t\t\t) {\r\n\t\t\t\tconst tideOracleMorgleTarget = pickRandom(\r\n\t\t\t\t\tkillerHero.hand\r\n\t\t\t\t\t\t.filter((e) => !!e?.cardId)\r\n\t\t\t\t\t\t.filter(\r\n\t\t\t\t\t\t\t(e) =>\r\n\t\t\t\t\t\t\t\tgameState.allCards.getCard(e.cardId).type?.toUpperCase() === CardType[CardType.MINION],\r\n\t\t\t\t\t\t),\r\n\t\t\t\t);\r\n\t\t\t\tif (tideOracleMorgleTarget) {\r\n\t\t\t\t\tconst tideOracleMorgleMultiplier = killer.cardId === CardIds.TideOracleMorgl_BG27_513 ? 1 : 2;\r\n\t\t\t\t\tmodifyStats(\r\n\t\t\t\t\t\ttideOracleMorgleTarget,\r\n\t\t\t\t\t\tkiller,\r\n\t\t\t\t\t\ttideOracleMorgleMultiplier * victim.attack,\r\n\t\t\t\t\t\ttideOracleMorgleMultiplier * victim.maxHealth,\r\n\t\t\t\t\t\tkillerBoard,\r\n\t\t\t\t\t\tkillerHero,\r\n\t\t\t\t\t\tgameState,\r\n\t\t\t\t\t);\r\n\t\t\t\t\tgameState.spectator.registerPowerTarget(\r\n\t\t\t\t\t\tkiller,\r\n\t\t\t\t\t\ttideOracleMorgleTarget,\r\n\t\t\t\t\t\tkillerBoard,\r\n\t\t\t\t\t\tkillerHero,\r\n\t\t\t\t\t\tvictimHero,\r\n\t\t\t\t\t);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t}\r\n\r\n\treturn { dmgDoneByAttacker: damageDoneByAttacker, dmgDoneByDefender: damageDoneByDefender };\r\n};\r\n"]}
|
|
@@ -4,3 +4,12 @@ import { BoardEntity } from '../../board-entity';
|
|
|
4
4
|
import { FullGameState } from '../internal-game-state';
|
|
5
5
|
export declare const makeMinionGolden: (target: BoardEntity, source: BoardEntity | BgsPlayerEntity | BoardTrinket, targetBoard: BoardEntity[], targetBoardHero: BgsPlayerEntity, otherBoard: BoardEntity[], otherHero: BgsPlayerEntity, gameState: FullGameState) => void;
|
|
6
6
|
export declare const isMinionGolden: (entity: BoardEntity, allCards: AllCardsService) => boolean;
|
|
7
|
+
export interface OnGildedInput {
|
|
8
|
+
entity: BoardEntity;
|
|
9
|
+
source: BoardEntity | BgsPlayerEntity | BoardTrinket;
|
|
10
|
+
targetBoard: BoardEntity[];
|
|
11
|
+
targetBoardHero: BgsPlayerEntity;
|
|
12
|
+
otherBoard: BoardEntity[];
|
|
13
|
+
otherHero: BgsPlayerEntity;
|
|
14
|
+
gameState: FullGameState;
|
|
15
|
+
}
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.isMinionGolden = exports.makeMinionGolden = void 0;
|
|
4
4
|
const reference_data_1 = require("@firestone-hs/reference-data");
|
|
5
|
+
const card_interface_1 = require("../../cards/card.interface");
|
|
6
|
+
const _card_mappings_1 = require("../../cards/impl/_card-mappings");
|
|
5
7
|
const eternal_portrait_1 = require("../../cards/impl/trinket/eternal-portrait");
|
|
6
8
|
const utils_1 = require("../../utils");
|
|
7
9
|
const add_minion_to_board_1 = require("../add-minion-to-board");
|
|
@@ -35,6 +37,18 @@ const makeMinionGolden = (target, source, targetBoard, targetBoardHero, otherBoa
|
|
|
35
37
|
!((_b = refCard.mechanics) === null || _b === void 0 ? void 0 : _b.includes(reference_data_1.GameTag[reference_data_1.GameTag.REBORN])));
|
|
36
38
|
target.avengeCurrent = avengeCurrent;
|
|
37
39
|
target.gildedInCombat = true;
|
|
40
|
+
const cardImpl = _card_mappings_1.cardMappings[target.cardId];
|
|
41
|
+
if ((0, card_interface_1.hasOnGilded)(cardImpl)) {
|
|
42
|
+
cardImpl.onGilded(target, {
|
|
43
|
+
entity: target,
|
|
44
|
+
source,
|
|
45
|
+
targetBoard,
|
|
46
|
+
targetBoardHero,
|
|
47
|
+
otherBoard,
|
|
48
|
+
otherHero,
|
|
49
|
+
gameState,
|
|
50
|
+
});
|
|
51
|
+
}
|
|
38
52
|
};
|
|
39
53
|
exports.makeMinionGolden = makeMinionGolden;
|
|
40
54
|
const isMinionGolden = (entity, allCards) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"golden.js","sourceRoot":"","sources":["../../../src/simulation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AI,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, GameTag } from '@firestone-hs/reference-data';\r\nimport { BgsPlayerEntity, BoardTrinket } from '../../bgs-player-entity';\r\nimport { BoardEntity } from '../../board-entity';\r\nimport { eternalKnightAttack, eternalKnightHealth } from '../../cards/impl/trinket/eternal-portrait';\r\nimport { CardIds } from '../../services/card-ids';\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 | BoardTrinket,\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\t// 33.6.2 (https://replays.firestoneapp.com/?reviewId=3b025701-01f5-4527-9d53-d8d67f78c5c8&turn=7&action=0)\r\n\t// The Phylactery enchantment exists before the Golden Deathrattle power so it goes first.\r\n\t// This most likely means that we need to create a new entityId when gilding a minion, so that it\r\n\t// is processed in the correct order.\r\n\ttarget.entityId = gameState.sharedState.currentEntityId++;\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\t// target.attack += refCard.attack;\r\n\t// target.health += refCard.health;\r\n\t// UPDATE 33.6: Defiant Shipwright going golden triggers its effect. Not sure how this should behave\r\n\t// https://replays.firestoneapp.com/?reviewId=52ae764d-6dc8-43cc-bd00-035a121e2388&turn=11&action=0\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\t// UPDATE 2026-04-17: Looks like this has been fixed / changed\r\n\t// https://replays.firestoneapp.com/?reviewId=5365a382-9c28-4cd8-8760-e7666cb701f3&turn=7&action=0\r\n\ttarget.reborn =\r\n\t\thasReborn ||\r\n\t\t(goldenCard.mechanics?.includes(GameTag[GameTag.REBORN]) &&\r\n\t\t\t!refCard.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\ttarget.gildedInCombat = true;\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(\r\n\t\t\t\t1,\r\n\t\t\t\tentity.health -\r\n\t\t\t\t\teternalKnightHealth * eternalKnighMultiplier * eternalKnightBuffToRemove -\r\n\t\t\t\t\thero.globalInfo.EternalKnightHealthBuff,\r\n\t\t\t);\r\n\t\t\tentity.attack = Math.max(\r\n\t\t\t\t0,\r\n\t\t\t\tentity.attack -\r\n\t\t\t\t\teternalKnightAttack * eternalKnighMultiplier * eternalKnightBuffToRemove -\r\n\t\t\t\t\thero.globalInfo.EternalKnightAttackBuff,\r\n\t\t\t);\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,iEAAwE;AAGxE,+DAAyD;AACzD,oEAA+D;AAC/D,gFAAqG;AAErG,uCAAkD;AAClD,gEAAqE;AAErE,0EAA4E;AAC5E,oCAAuC;AAEhC,MAAM,gBAAgB,GAAG,CAC/B,MAAmB,EACnB,MAAoD,EACpD,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,IAAI,CAAC,CAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,EAAE,CAAA,EAAE;QACpB,UAAU,GAAG,OAAO,CAAC;KACrB;IAeD,MAAM,CAAC,MAAM,GAAG,UAAU,CAAC,EAAE,CAAC;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} from '../../bgs-player-entity';\r\nimport { BoardEntity } from '../../board-entity';\r\nimport { hasOnGilded } from '../../cards/card.interface';\r\nimport { cardMappings } from '../../cards/impl/_card-mappings';\r\nimport { eternalKnightAttack, eternalKnightHealth } from '../../cards/impl/trinket/eternal-portrait';\r\nimport { CardIds } from '../../services/card-ids';\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 | BoardTrinket,\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\t// 33.6.2 (https://replays.firestoneapp.com/?reviewId=3b025701-01f5-4527-9d53-d8d67f78c5c8&turn=7&action=0)\r\n\t// The Phylactery enchantment exists before the Golden Deathrattle power so it goes first.\r\n\t// This most likely means that we need to create a new entityId when gilding a minion, so that it\r\n\t// is processed in the correct order.\r\n\ttarget.entityId = gameState.sharedState.currentEntityId++;\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\t// target.attack += refCard.attack;\r\n\t// target.health += refCard.health;\r\n\t// UPDATE 33.6: Defiant Shipwright going golden triggers its effect. Not sure how this should behave\r\n\t// https://replays.firestoneapp.com/?reviewId=52ae764d-6dc8-43cc-bd00-035a121e2388&turn=11&action=0\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\t// UPDATE 2026-04-17: Looks like this has been fixed / changed\r\n\t// https://replays.firestoneapp.com/?reviewId=5365a382-9c28-4cd8-8760-e7666cb701f3&turn=7&action=0\r\n\ttarget.reborn =\r\n\t\thasReborn ||\r\n\t\t(goldenCard.mechanics?.includes(GameTag[GameTag.REBORN]) &&\r\n\t\t\t!refCard.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\ttarget.gildedInCombat = true;\r\n\tconst cardImpl = cardMappings[target.cardId];\r\n\tif (hasOnGilded(cardImpl)) {\r\n\t\tcardImpl.onGilded(target, {\r\n\t\t\tentity: target,\r\n\t\t\tsource,\r\n\t\t\ttargetBoard,\r\n\t\t\ttargetBoardHero,\r\n\t\t\totherBoard,\r\n\t\t\totherHero,\r\n\t\t\tgameState,\r\n\t\t});\r\n\t}\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(\r\n\t\t\t\t1,\r\n\t\t\t\tentity.health -\r\n\t\t\t\t\teternalKnightHealth * eternalKnighMultiplier * eternalKnightBuffToRemove -\r\n\t\t\t\t\thero.globalInfo.EternalKnightHealthBuff,\r\n\t\t\t);\r\n\t\t\tentity.attack = Math.max(\r\n\t\t\t\t0,\r\n\t\t\t\tentity.attack -\r\n\t\t\t\t\teternalKnightAttack * eternalKnighMultiplier * eternalKnightBuffToRemove -\r\n\t\t\t\t\thero.globalInfo.EternalKnightAttackBuff,\r\n\t\t\t);\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\r\nexport interface OnGildedInput {\r\n\tentity: BoardEntity;\r\n\tsource: BoardEntity | BgsPlayerEntity | BoardTrinket;\r\n\ttargetBoard: BoardEntity[];\r\n\ttargetBoardHero: BgsPlayerEntity;\r\n\totherBoard: BoardEntity[];\r\n\totherHero: BgsPlayerEntity;\r\n\tgameState: FullGameState;\r\n}\r\n"]}
|