@firestone-hs/simulate-bgs-battle 1.1.545 → 1.1.547
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 -0
- package/dist/bgs-player-entity.js.map +1 -1
- package/dist/board-entity.d.ts +0 -1
- package/dist/board-entity.js.map +1 -1
- package/dist/cards/card.interface.d.ts +1 -1
- package/dist/cards/card.interface.js.map +1 -1
- package/dist/cards/impl/minion/battlecruiser.js +14 -5
- package/dist/cards/impl/minion/battlecruiser.js.map +1 -1
- package/dist/cards/impl/minion/bellowing-tyrant.js +2 -2
- package/dist/cards/impl/minion/bellowing-tyrant.js.map +1 -1
- package/dist/cards/impl/minion/carrier.js +3 -2
- package/dist/cards/impl/minion/carrier.js.map +1 -1
- package/dist/cards/impl/minion/mutalisk.js +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/cards/impl/minion/zergling.js +10 -7
- package/dist/cards/impl/minion/zergling.js.map +1 -1
- package/dist/simulate-bgs-battle.js +1 -0
- package/dist/simulate-bgs-battle.js.map +1 -1
- package/dist/simulation/attack.js +2 -4
- package/dist/simulation/attack.js.map +1 -1
- package/dist/simulation/auras.js +17 -16
- package/dist/simulation/auras.js.map +1 -1
- package/dist/simulation/avenge.js +4 -1
- package/dist/simulation/avenge.js.map +1 -1
- package/dist/simulation/deathrattle-effects.js +3 -1
- package/dist/simulation/deathrattle-effects.js.map +1 -1
- package/dist/simulation/magnetize.js +5 -0
- package/dist/simulation/magnetize.js.map +1 -1
- package/dist/simulation/minion-kill.js +2 -1
- package/dist/simulation/minion-kill.js.map +1 -1
- package/dist/simulation/shared-state.d.ts +1 -0
- package/dist/simulation/shared-state.js +1 -0
- package/dist/simulation/shared-state.js.map +1 -1
- package/dist/simulation/summon-when-space.js +6 -0
- package/dist/simulation/summon-when-space.js.map +1 -1
- package/dist/utils.js +0 -1
- package/dist/utils.js.map +1 -1
- package/package.json +1 -1
|
@@ -56,6 +56,7 @@ export interface BgsPlayerGlobalInfo {
|
|
|
56
56
|
TavernSpellsCastThisGame?: number;
|
|
57
57
|
PiratesPlayedThisGame?: number;
|
|
58
58
|
BeastsSummonedThisGame?: number;
|
|
59
|
+
MagnetizedThisGame?: number;
|
|
59
60
|
PiratesSummonedThisGame?: number;
|
|
60
61
|
PirateAttackBonus?: number;
|
|
61
62
|
AstralAutomatonsSummonedThisGame?: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bgs-player-entity.js","sourceRoot":"","sources":["../src/bgs-player-entity.ts"],"names":[],"mappings":"","sourcesContent":["import { BoardEntity } from './board-entity';\r\nimport { BoardSecret } from './board-secret';\r\n\r\nexport interface BgsPlayerEntity {\r\n\tcardId: string;\r\n\t// readonly nonGhostCardId?: string;\r\n\thpLeft: number;\r\n\treadonly tavernTier: number;\r\n\theroPowers: readonly BgsHeroPower[];\r\n\r\n\t/** @deprecated */\r\n\theroPowerId?: string | undefined | null;\r\n\t/** @deprecated */\r\n\treadonly heroPowerEntityId?: number;\r\n\t/** @deprecated */\r\n\treadonly heroPowerUsed: boolean;\r\n\t/** @deprecated */\r\n\treadonly heroPowerInfo?: number | string;\r\n\t/** @deprecated */\r\n\theroPowerInfo2?: number;\r\n\t/** @deprecated */\r\n\tavengeCurrent?: number;\r\n\t/** @deprecated */\r\n\tavengeDefault?: number;\r\n\t// For Ozumat\r\n\t/** @deprecated */\r\n\theroPowerActivated?: boolean;\r\n\r\n\tfriendly?: boolean;\r\n\tentityId?: number;\r\n\tquestEntities: BgsQuestEntity[];\r\n\tquestRewards?: string[];\r\n\tquestRewardEntities?: {\r\n\t\tcardId: string;\r\n\t\tentityId: number;\r\n\t\tavengeDefault?: number;\r\n\t\tavengeCurrent?: number;\r\n\t\tscriptDataNum1: number;\r\n\t}[];\r\n\thand?: BoardEntity[];\r\n\tsecrets?: BoardSecret[];\r\n\ttrinkets?: BoardTrinket[];\r\n\tglobalInfo?: BgsPlayerGlobalInfo;\r\n\tstartOfCombatDone?: boolean;\r\n\r\n\tdeadEyeDamageDone?: number;\r\n\trapidReanimationMinion?: BoardEntity;\r\n\trapidReanimationIndexFromLeft?: number;\r\n\trapidReanimationIndexFromRight?: number;\r\n}\r\n\r\nexport interface BgsHeroPower {\r\n\tcardId: string;\r\n\tentityId: number;\r\n\tused: boolean;\r\n\tinfo: number | string;\r\n\tinfo2: number;\r\n\tavengeCurrent?: number;\r\n\tavengeDefault?: number;\r\n\t// For Ozumat's Tentacular\r\n\tactivated?: boolean;\r\n}\r\n\r\nexport interface BgsPlayerGlobalInfo {\r\n\tEternalKnightsDeadThisGame?: number;\r\n\tSanlaynScribesDeadThisGame?: number;\r\n\tUndeadAttackBonus?: number;\r\n\tFrostlingBonus?: number;\r\n\tBloodGemAttackBonus?: number;\r\n\tBloodGemHealthBonus?: number;\r\n\tGoldrinnBuffAtk?: number;\r\n\tGoldrinnBuffHealth?: number;\r\n\tTavernSpellsCastThisGame?: number;\r\n\tPiratesPlayedThisGame?: number;\r\n\tBeastsSummonedThisGame?: number;\r\n\tPiratesSummonedThisGame?: number;\r\n\tPirateAttackBonus?: number;\r\n\tAstralAutomatonsSummonedThisGame?: number;\r\n\tChoralAttackBuff?: number;\r\n\tChoralHealthBuff?: number;\r\n\tBeetleAttackBuff?: number;\r\n\tBeetleHealthBuff?: number;\r\n\tMutatedLasherAttackBuff?: number;\r\n\tMutatedLasherHealthBuff?: number;\r\n\tBattlecriesTriggeredThisGame?: number;\r\n\tFriendlyMinionsDeadLastCombat?: number;\r\n}\r\n\r\nexport interface BgsQuestEntity {\r\n\tCardId: string;\r\n\tRewardDbfId: number;\r\n\tProgressCurrent: number;\r\n\tProgressTotal: number;\r\n}\r\n\r\nexport interface BoardTrinket {\r\n\tcardId: string;\r\n\tentityId: number;\r\n\tscriptDataNum1: number;\r\n\tscriptDataNum6?: number;\r\n\trememberedMinion?: BoardEntity;\r\n\tavengeDefault?: number;\r\n\tavengeCurrent?: number;\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"bgs-player-entity.js","sourceRoot":"","sources":["../src/bgs-player-entity.ts"],"names":[],"mappings":"","sourcesContent":["import { BoardEntity } from './board-entity';\r\nimport { BoardSecret } from './board-secret';\r\n\r\nexport interface BgsPlayerEntity {\r\n\tcardId: string;\r\n\t// readonly nonGhostCardId?: string;\r\n\thpLeft: number;\r\n\treadonly tavernTier: number;\r\n\theroPowers: readonly BgsHeroPower[];\r\n\r\n\t/** @deprecated */\r\n\theroPowerId?: string | undefined | null;\r\n\t/** @deprecated */\r\n\treadonly heroPowerEntityId?: number;\r\n\t/** @deprecated */\r\n\treadonly heroPowerUsed: boolean;\r\n\t/** @deprecated */\r\n\treadonly heroPowerInfo?: number | string;\r\n\t/** @deprecated */\r\n\theroPowerInfo2?: number;\r\n\t/** @deprecated */\r\n\tavengeCurrent?: number;\r\n\t/** @deprecated */\r\n\tavengeDefault?: number;\r\n\t// For Ozumat\r\n\t/** @deprecated */\r\n\theroPowerActivated?: boolean;\r\n\r\n\tfriendly?: boolean;\r\n\tentityId?: number;\r\n\tquestEntities: BgsQuestEntity[];\r\n\tquestRewards?: string[];\r\n\tquestRewardEntities?: {\r\n\t\tcardId: string;\r\n\t\tentityId: number;\r\n\t\tavengeDefault?: number;\r\n\t\tavengeCurrent?: number;\r\n\t\tscriptDataNum1: number;\r\n\t}[];\r\n\thand?: BoardEntity[];\r\n\tsecrets?: BoardSecret[];\r\n\ttrinkets?: BoardTrinket[];\r\n\tglobalInfo?: BgsPlayerGlobalInfo;\r\n\tstartOfCombatDone?: boolean;\r\n\r\n\tdeadEyeDamageDone?: number;\r\n\trapidReanimationMinion?: BoardEntity;\r\n\trapidReanimationIndexFromLeft?: number;\r\n\trapidReanimationIndexFromRight?: number;\r\n}\r\n\r\nexport interface BgsHeroPower {\r\n\tcardId: string;\r\n\tentityId: number;\r\n\tused: boolean;\r\n\tinfo: number | string;\r\n\tinfo2: number;\r\n\tavengeCurrent?: number;\r\n\tavengeDefault?: number;\r\n\t// For Ozumat's Tentacular\r\n\tactivated?: boolean;\r\n}\r\n\r\nexport interface BgsPlayerGlobalInfo {\r\n\tEternalKnightsDeadThisGame?: number;\r\n\tSanlaynScribesDeadThisGame?: number;\r\n\tUndeadAttackBonus?: number;\r\n\tFrostlingBonus?: number;\r\n\tBloodGemAttackBonus?: number;\r\n\tBloodGemHealthBonus?: number;\r\n\tGoldrinnBuffAtk?: number;\r\n\tGoldrinnBuffHealth?: number;\r\n\tTavernSpellsCastThisGame?: number;\r\n\tPiratesPlayedThisGame?: number;\r\n\tBeastsSummonedThisGame?: number;\r\n\tMagnetizedThisGame?: number;\r\n\tPiratesSummonedThisGame?: number;\r\n\tPirateAttackBonus?: number;\r\n\tAstralAutomatonsSummonedThisGame?: number;\r\n\tChoralAttackBuff?: number;\r\n\tChoralHealthBuff?: number;\r\n\tBeetleAttackBuff?: number;\r\n\tBeetleHealthBuff?: number;\r\n\tMutatedLasherAttackBuff?: number;\r\n\tMutatedLasherHealthBuff?: number;\r\n\tBattlecriesTriggeredThisGame?: number;\r\n\tFriendlyMinionsDeadLastCombat?: number;\r\n}\r\n\r\nexport interface BgsQuestEntity {\r\n\tCardId: string;\r\n\tRewardDbfId: number;\r\n\tProgressCurrent: number;\r\n\tProgressTotal: number;\r\n}\r\n\r\nexport interface BoardTrinket {\r\n\tcardId: string;\r\n\tentityId: number;\r\n\tscriptDataNum1: number;\r\n\tscriptDataNum6?: number;\r\n\trememberedMinion?: BoardEntity;\r\n\tavengeDefault?: number;\r\n\tavengeCurrent?: number;\r\n}\r\n"]}
|
package/dist/board-entity.d.ts
CHANGED
package/dist/board-entity.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"board-entity.js","sourceRoot":"","sources":["../src/board-entity.ts"],"names":[],"mappings":"","sourcesContent":["export interface BoardEntity {\r\n\tentityId: number;\r\n\tcardId: string;\r\n\tattack: number;\r\n\thealth: number;\r\n\r\n\tmaxHealth?: number;\r\n\tmaxAttack?: number;\r\n\tavengeCurrent?: number;\r\n\tavengeDefault?: number;\r\n\tfrenzyChargesLeft?: number;\r\n\tdefinitelyDead?: boolean;\r\n\ttaunt?: boolean;\r\n\tdivineShield?: boolean;\r\n\tpoisonous?: boolean;\r\n\tvenomous?: boolean;\r\n\treborn?: boolean;\r\n\trebornFromEntityId?: number;\r\n\tcleave?: boolean;\r\n\twindfury?: boolean;\r\n\tstealth?: boolean;\r\n\tenchantments?: {\r\n\t\tcardId: string;\r\n\t\toriginEntityId?: number;\r\n\t\ttagScriptDataNum1?: number;\r\n\t\ttagScriptDataNum2?: number;\r\n\t\ttiming: number;\r\n\t\trepeats?: number;\r\n\t\tvalue?: number;\r\n\t}[];\r\n\tpendingAttackBuffs?: number[];\r\n\tscriptDataNum1?: number;\r\n\tscriptDataNum2?: number;\r\n\tinInitialState?: boolean;\r\n\t// For Build-An-Undead and Zilliax\r\n\tadditionalCards?: readonly string[] | null;\r\n\r\n\t// We only store the card id, because we want all the attack and other data to be computed at runtime, based on the\r\n\t// current stats of the Fish\r\n\trememberedDeathrattles?: { cardId: string; timing: number; repeats: number }[];\r\n\tdeathrattleRepeats?: number;\r\n\tdamageMultiplier?: number;\r\n\tlocked?: boolean;\r\n\tfriendly?: boolean;\r\n\tcantAttack?: boolean;\r\n\thasAttacked?: number;\r\n\timmuneWhenAttackCharges?: number;\r\n\tattackImmediately?: boolean;\r\n\t// Used only to handle murkeye aura?\r\n\tpreviousAttack?: number;\r\n\tlastAffectedByEntity?: BoardEntity;\r\n\
|
|
1
|
+
{"version":3,"file":"board-entity.js","sourceRoot":"","sources":["../src/board-entity.ts"],"names":[],"mappings":"","sourcesContent":["export interface BoardEntity {\r\n\tentityId: number;\r\n\tcardId: string;\r\n\tattack: number;\r\n\thealth: number;\r\n\r\n\tmaxHealth?: number;\r\n\tmaxAttack?: number;\r\n\tavengeCurrent?: number;\r\n\tavengeDefault?: number;\r\n\tfrenzyChargesLeft?: number;\r\n\tdefinitelyDead?: boolean;\r\n\ttaunt?: boolean;\r\n\tdivineShield?: boolean;\r\n\tpoisonous?: boolean;\r\n\tvenomous?: boolean;\r\n\treborn?: boolean;\r\n\trebornFromEntityId?: number;\r\n\tcleave?: boolean;\r\n\twindfury?: boolean;\r\n\tstealth?: boolean;\r\n\tenchantments?: {\r\n\t\tcardId: string;\r\n\t\toriginEntityId?: number;\r\n\t\ttagScriptDataNum1?: number;\r\n\t\ttagScriptDataNum2?: number;\r\n\t\ttiming: number;\r\n\t\trepeats?: number;\r\n\t\tvalue?: number;\r\n\t}[];\r\n\tpendingAttackBuffs?: number[];\r\n\tscriptDataNum1?: number;\r\n\tscriptDataNum2?: number;\r\n\tinInitialState?: boolean;\r\n\t// For Build-An-Undead and Zilliax\r\n\tadditionalCards?: readonly string[] | null;\r\n\r\n\t// We only store the card id, because we want all the attack and other data to be computed at runtime, based on the\r\n\t// current stats of the Fish\r\n\trememberedDeathrattles?: { cardId: string; timing: number; repeats: number }[];\r\n\tdeathrattleRepeats?: number;\r\n\tdamageMultiplier?: number;\r\n\tlocked?: boolean;\r\n\tfriendly?: boolean;\r\n\tcantAttack?: boolean;\r\n\thasAttacked?: number;\r\n\timmuneWhenAttackCharges?: number;\r\n\tattackImmediately?: boolean;\r\n\t// Used only to handle murkeye aura?\r\n\tpreviousAttack?: number;\r\n\tlastAffectedByEntity?: BoardEntity;\r\n\t// attacking?: boolean;\r\n\t// Did it have divine shield at least once? (for Sinrunner Blanchy)\r\n\thadDivineShield?: boolean;\r\n\tabiityChargesLeft?: number;\r\n\tindexFromLeftAtTimeOfDeath?: number;\r\n\r\n\t// permanentAttack?: number;\r\n\t// permanentHealth?: number;\r\n\ttavernTier?: number;\r\n\r\n\tmemory?: any;\r\n\r\n\tonCanceledSummon?: () => void;\r\n}\r\n"]}
|
|
@@ -79,7 +79,7 @@ export interface OnBattlecryTriggeredCard extends Card {
|
|
|
79
79
|
}
|
|
80
80
|
export declare const hasOnBattlecryTriggered: (card: Card) => card is OnBattlecryTriggeredCard;
|
|
81
81
|
export interface AvengeCard extends Card {
|
|
82
|
-
avenge: (minion: BoardEntity, input: AvengeInput) => void;
|
|
82
|
+
avenge: (minion: BoardEntity, input: AvengeInput) => void | readonly BoardEntity[];
|
|
83
83
|
baseAvengeValue: (cardId: string) => number;
|
|
84
84
|
}
|
|
85
85
|
export declare const hasAvenge: (card: Card) => card is AvengeCard;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"card.interface.js","sourceRoot":"","sources":["../../src/cards/card.interface.ts"],"names":[],"mappings":";;;AAsCO,MAAM,iBAAiB,GAAG,CAAC,IAAU,EAA8B,EAAE,CAC3E,CAAC,IAA2B,aAA3B,IAAI,uBAAJ,IAAI,CAAyB,cAAc,MAAK,SAAS,CAAC;AAD/C,QAAA,iBAAiB,qBAC8B;AAMrD,MAAM,gBAAgB,GAAG,CAAC,IAAU,EAA6B,EAAE,CACzE,CAAC,IAA0B,aAA1B,IAAI,uBAAJ,IAAI,CAAwB,aAAa,MAAK,SAAS,CAAC;AAD7C,QAAA,gBAAgB,oBAC6B;AAUnD,MAAM,WAAW,GAAG,CAAC,IAAU,EAAwB,EAAE,CAC/D,CAAC,IAAqB,aAArB,IAAI,uBAAJ,IAAI,CAAmB,iBAAiB,MAAK,SAAS,CAAC;AAD5C,QAAA,WAAW,eACiC;AAKlD,MAAM,YAAY,GAAG,CAAC,IAAU,EAAyB,EAAE,CAAC,CAAC,IAAsB,aAAtB,IAAI,uBAAJ,IAAI,CAAoB,SAAS,MAAK,SAAS,CAAC;AAAvG,QAAA,YAAY,gBAA2F;AAK7G,MAAM,qBAAqB,GAAG,CAAC,IAAU,EAAkC,EAAE,CACnF,CAAC,IAA+B,aAA/B,IAAI,uBAAJ,IAAI,CAA6B,kBAAkB,MAAK,SAAS,CAAC;AADvD,QAAA,qBAAqB,yBACkC;AAK7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PlayerEntity, BgsQuestEntity, BoardTrinket } from '../bgs-player-entity';\r\nimport { BoardEntity } from '../board-entity';\r\nimport { BoardSecret } from '../board-secret';\r\nimport { OnDivineShieldUpdatedInput } from '../keywords/divine-shield';\r\nimport { OnRebornUpdatedInput } from '../keywords/reborn';\r\nimport { OnStealthUpdatedInput } from '../keywords/stealth';\r\nimport { OnTauntUpdatedInput } from '../keywords/taunt';\r\nimport { OnVenomousUpdatedInput } from '../keywords/venomous';\r\nimport { OnWindfuryUpdatedInput } from '../keywords/windfury';\r\nimport {\r\n\tOnDespawnInput,\r\n\tOnOtherSpawnAuraInput,\r\n\tOnOtherSpawnInput,\r\n\tOnSpawnInput,\r\n} from '../simulation/add-minion-to-board';\r\nimport { OnDeathInput, OnMinionKilledInput } from '../simulation/attack';\r\nimport { AvengeInput } from '../simulation/avenge';\r\nimport { BattlecryInput, OnBattlecryTriggeredInput } from '../simulation/battlecries';\r\nimport { OnCardAddedToHandInput } from '../simulation/cards-in-hand';\r\nimport { AfterHeroDamagedInput } from '../simulation/damage-to-hero';\r\nimport { DeathrattleTriggeredInput } from '../simulation/deathrattle-on-trigger';\r\nimport { OnAttackInput } from '../simulation/on-attack';\r\nimport { RebornEffectInput } from '../simulation/reborn';\r\nimport { SoCInput } from '../simulation/start-of-combat/start-of-combat-input';\r\nimport { OnStatsChangedInput } from '../simulation/stats';\r\n\r\nexport interface Card {\r\n\t// Maybe should make this mandatory\r\n\tcardIds?: readonly string[];\r\n\tstartOfCombat?: (\r\n\t\ttrinket: BoardEntity | BoardTrinket | BgsPlayerEntity | BoardSecret,\r\n\t\tinput: SoCInput,\r\n\t) => boolean | { hasTriggered: boolean; shouldRecomputeCurrentAttacker: boolean };\r\n}\r\n\r\nexport interface DefaultChargesCard extends Card {\r\n\tdefaultCharges: (entity: BoardEntity) => number;\r\n}\r\nexport const hasDefaultCharges = (card: Card): card is DefaultChargesCard =>\r\n\t(card as DefaultChargesCard)?.defaultCharges !== undefined;\r\n\r\nexport interface StartOfCombatCard extends Card {\r\n\tstartOfCombatTiming?: StartOfCombatTiming;\r\n\tstartOfCombat: NonNullable<Card['startOfCombat']>;\r\n}\r\nexport const hasStartOfCombat = (card: Card): card is StartOfCombatCard =>\r\n\t(card as StartOfCombatCard)?.startOfCombat !== undefined;\r\nexport type StartOfCombatTiming = 'start-of-combat' | 'pre-combat' | 'illidan';\r\n\r\n// Whenever this attacks\r\nexport interface OnAttackCard extends Card {\r\n\tonAnyMinionAttack: (\r\n\t\tminion: BoardEntity,\r\n\t\tinput: OnAttackInput,\r\n\t) => { dmgDoneByAttacker: number; dmgDoneByDefender: number };\r\n}\r\nexport const hasOnAttack = (card: Card): card is OnAttackCard =>\r\n\t(card as OnAttackCard)?.onAnyMinionAttack !== undefined;\r\n\r\nexport interface OnSpawnedCard extends Card {\r\n\tonSpawned: (minion: BoardEntity, input: OnSpawnInput) => void;\r\n}\r\nexport const hasOnSpawned = (card: Card): card is OnSpawnedCard => (card as OnSpawnedCard)?.onSpawned !== undefined;\r\n\r\nexport interface OnOtherSpawnedAuraCard extends Card {\r\n\tonOtherSpawnedAura: (minion: BoardEntity, input: OnOtherSpawnAuraInput) => void;\r\n}\r\nexport const hasOnOtherAuraSpawned = (card: Card): card is OnOtherSpawnedAuraCard =>\r\n\t(card as OnOtherSpawnedAuraCard)?.onOtherSpawnedAura !== undefined;\r\n\r\nexport interface OnOtherSpawnedCard extends Card {\r\n\tonOtherSpawned: (minion: BoardEntity, input: OnOtherSpawnInput) => void;\r\n}\r\nexport const hasOnOtherSpawned = (card: Card): card is OnOtherSpawnedCard =>\r\n\t(card as OnOtherSpawnedCard)?.onOtherSpawned !== undefined;\r\n\r\nexport interface AfterOtherSpawnedCard extends Card {\r\n\tafterOtherSpawned: (minion: BoardEntity, input: OnOtherSpawnInput) => void;\r\n}\r\nexport const hasAfterOtherSpawned = (card: Card): card is AfterOtherSpawnedCard =>\r\n\t(card as AfterOtherSpawnedCard)?.afterOtherSpawned !== undefined;\r\n\r\nexport interface OnDespawnedCard extends Card {\r\n\tonDespawned: (minion: BoardEntity, input: OnDespawnInput) => void;\r\n}\r\nexport const hasOnDespawned = (card: Card): card is OnDespawnedCard =>\r\n\t(card as OnDespawnedCard)?.onDespawned !== undefined;\r\n\r\nexport interface DeathrattleSpawnCard extends Card {\r\n\tdeathrattleSpawn: (minion: BoardEntity, input: DeathrattleTriggeredInput) => readonly BoardEntity[];\r\n}\r\nexport const hasDeathrattleSpawn = (card: Card): card is DeathrattleSpawnCard =>\r\n\t(card as DeathrattleSpawnCard)?.deathrattleSpawn !== undefined;\r\n\r\nexport interface BattlecryCard extends Card {\r\n\tbattlecry: (minion: BoardEntity, input: BattlecryInput) => void;\r\n}\r\nexport const hasBattlecry = (card: Card): card is BattlecryCard => (card as BattlecryCard)?.battlecry !== undefined;\r\n\r\nexport interface RebornEffectCard extends Card {\r\n\trebornEffect: (minion: BoardEntity, input: RebornEffectInput) => void;\r\n}\r\nexport const hasRebornEffect = (card: Card): card is RebornEffectCard =>\r\n\t(card as RebornEffectCard)?.rebornEffect !== undefined;\r\n\r\nexport interface OnBattlecryTriggeredCard extends Card {\r\n\tonBattlecryTriggered: (minion: BoardEntity, input: OnBattlecryTriggeredInput) => void;\r\n}\r\nexport const hasOnBattlecryTriggered = (card: Card): card is OnBattlecryTriggeredCard =>\r\n\t(card as OnBattlecryTriggeredCard)?.onBattlecryTriggered !== undefined;\r\n\r\nexport interface AvengeCard extends Card {\r\n\tavenge: (minion: BoardEntity, input: AvengeInput) => void;\r\n\tbaseAvengeValue: (cardId: string) => number;\r\n}\r\nexport const hasAvenge = (card: Card): card is AvengeCard => (card as AvengeCard)?.avenge !== undefined;\r\n\r\nexport interface DeathrattleEffectCard extends Card {\r\n\tdeathrattleEffect: (minion: BoardEntity, input: DeathrattleTriggeredInput) => void;\r\n}\r\nexport const hasDeathrattleEffect = (card: Card): card is DeathrattleEffectCard =>\r\n\t(card as DeathrattleEffectCard)?.deathrattleEffect !== undefined;\r\n\r\nexport interface DeathrattleEnchantmentEffectCard extends Card {\r\n\tdeathrattleEffectEnchantmentEffect: (\r\n\t\tminion: { cardId: string; originEntityId?: number; repeats?: number },\r\n\t\tinput: DeathrattleTriggeredInput,\r\n\t) => void;\r\n\tcardIds: readonly string[];\r\n}\r\nexport const hasDeathrattleEnchantmentEffect = (card: Card): card is DeathrattleEnchantmentEffectCard =>\r\n\t(card as DeathrattleEnchantmentEffectCard)?.deathrattleEffectEnchantmentEffect !== undefined;\r\n\r\nexport interface DeathrattleSpawnEnchantmentCard extends Card {\r\n\tdeathrattleSpawnEnchantmentEffect: (\r\n\t\tminion: { cardId: string; originEntityId?: number; repeats?: number },\r\n\t\tinput: DeathrattleTriggeredInput,\r\n\t) => readonly BoardEntity[];\r\n\tcardIds: readonly string[];\r\n}\r\nexport const hasDeathrattleSpawnEnchantment = (card: Card): card is DeathrattleSpawnEnchantmentCard =>\r\n\t(card as DeathrattleSpawnEnchantmentCard)?.deathrattleSpawnEnchantmentEffect !== undefined;\r\n\r\nexport interface OnCardAddedToHandCard extends Card {\r\n\tonCardAddedToHand: (entity: BoardEntity | BgsQuestEntity, input: OnCardAddedToHandInput) => void;\r\n}\r\nexport const hasOnCardAddedToHand = (card: Card): card is OnCardAddedToHandCard =>\r\n\t(card as OnCardAddedToHandCard)?.onCardAddedToHand !== undefined;\r\n\r\nexport interface EndOfTurnCard extends Card {\r\n\t// Use BattlecryInput because it's the only way end of turn effects are triggered\r\n\tendOfTurn: (entity: BoardEntity, input: EndOfTurnInput) => void;\r\n}\r\nexport const hasEndOfTurn = (card: Card): card is EndOfTurnCard => (card as EndOfTurnCard)?.endOfTurn !== undefined;\r\nexport type EndOfTurnInput = BattlecryInput;\r\n\r\nexport interface OnDivineShieldUpdatedCard extends Card {\r\n\tonDivineShieldUpdated: (entity: BoardEntity, input: OnDivineShieldUpdatedInput) => void;\r\n}\r\nexport const hasOnDivineShieldUpdated = (card: Card): card is OnDivineShieldUpdatedCard =>\r\n\t(card as OnDivineShieldUpdatedCard)?.onDivineShieldUpdated !== undefined;\r\n\r\nexport interface OnTauntUpdatedCard extends Card {\r\n\tonTauntUpdated: (\r\n\t\tentity: BoardEntity,\r\n\t\timpactedEntity: BoardEntity,\r\n\t\tpreviousValue: boolean,\r\n\t\tinput: OnTauntUpdatedInput,\r\n\t) => void;\r\n}\r\nexport const hasOnTauntUpdated = (card: Card): card is OnTauntUpdatedCard =>\r\n\t(card as OnTauntUpdatedCard)?.onTauntUpdated !== undefined;\r\n\r\nexport interface OnRebornUpdatedCard extends Card {\r\n\tonRebornUpdated: (\r\n\t\tentity: BoardEntity,\r\n\t\timpactedEntity: BoardEntity,\r\n\t\tpreviousValue: boolean,\r\n\t\tinput: OnRebornUpdatedInput,\r\n\t) => void;\r\n}\r\nexport const hasOnRebornUpdated = (card: Card): card is OnRebornUpdatedCard =>\r\n\t(card as OnRebornUpdatedCard)?.onRebornUpdated !== undefined;\r\n\r\nexport interface OnStealthUpdatedCard extends Card {\r\n\tonStealthUpdated: (\r\n\t\tentity: BoardEntity,\r\n\t\timpactedEntity: BoardEntity,\r\n\t\tpreviousValue: boolean,\r\n\t\tinput: OnStealthUpdatedInput,\r\n\t) => void;\r\n}\r\nexport const hasOnStealthUpdated = (card: Card): card is OnStealthUpdatedCard =>\r\n\t(card as OnStealthUpdatedCard)?.onStealthUpdated !== undefined;\r\n\r\nexport interface OnVenomousUpdatedCard extends Card {\r\n\tonVenomousUpdated: (\r\n\t\tentity: BoardEntity,\r\n\t\timpactedEntity: BoardEntity,\r\n\t\tpreviousValue: boolean,\r\n\t\tinput: OnVenomousUpdatedInput,\r\n\t) => void;\r\n}\r\nexport const hasOnVenomousUpdated = (card: Card): card is OnVenomousUpdatedCard =>\r\n\t(card as OnVenomousUpdatedCard)?.onVenomousUpdated !== undefined;\r\n\r\nexport interface OnWindfuryUpdatedCard extends Card {\r\n\tonWindfuryUpdated: (\r\n\t\tentity: BoardEntity,\r\n\t\timpactedEntity: BoardEntity,\r\n\t\tpreviousValue: boolean,\r\n\t\tinput: OnWindfuryUpdatedInput,\r\n\t) => void;\r\n}\r\nexport const hasOnWindfuryUpdated = (card: Card): card is OnWindfuryUpdatedCard =>\r\n\t(card as OnWindfuryUpdatedCard)?.onWindfuryUpdated !== undefined;\r\n\r\nexport interface OnStatsChangedCard extends Card {\r\n\tonStatsChanged: (entity: BoardEntity, input: OnStatsChangedInput) => void;\r\n}\r\nexport const hasOnStatsChanged = (card: Card): card is OnStatsChangedCard =>\r\n\t(card as OnStatsChangedCard)?.onStatsChanged !== undefined;\r\n\r\nexport interface AfterHeroDamagedCard extends Card {\r\n\tafterHeroDamaged: (entity: BoardEntity, input: AfterHeroDamagedInput) => void;\r\n}\r\nexport const hasAfterHeroDamaged = (card: Card): card is AfterHeroDamagedCard =>\r\n\t(card as AfterHeroDamagedCard)?.afterHeroDamaged !== undefined;\r\n\r\nexport interface OnDeathCard extends Card {\r\n\tonDeath: (entity: BoardEntity, input: OnDeathInput) => void;\r\n}\r\nexport const hasOnDeath = (card: Card): card is OnDeathCard => (card as OnDeathCard)?.onDeath !== undefined;\r\n\r\nexport interface OnMinionKilledCard extends Card {\r\n\tonMinionKilled: (\r\n\t\tentity: BoardEntity,\r\n\t\tinput: OnMinionKilledInput,\r\n\t) => { dmgDoneByAttacker: number; dmgDoneByDefender: number };\r\n}\r\nexport const hasOnMinionKilled = (card: Card): card is OnMinionKilledCard =>\r\n\t(card as OnMinionKilledCard)?.onMinionKilled !== undefined;\r\n"]}
|
|
1
|
+
{"version":3,"file":"card.interface.js","sourceRoot":"","sources":["../../src/cards/card.interface.ts"],"names":[],"mappings":";;;AAsCO,MAAM,iBAAiB,GAAG,CAAC,IAAU,EAA8B,EAAE,CAC3E,CAAC,IAA2B,aAA3B,IAAI,uBAAJ,IAAI,CAAyB,cAAc,MAAK,SAAS,CAAC;AAD/C,QAAA,iBAAiB,qBAC8B;AAMrD,MAAM,gBAAgB,GAAG,CAAC,IAAU,EAA6B,EAAE,CACzE,CAAC,IAA0B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BAAJ,IAAI,CAAyB,cAAc,MAAK,SAAS,CAAC;AAD/C,QAAA,iBAAiB,qBAC8B;AAKrD,MAAM,mBAAmB,GAAG,CAAC,IAAU,EAAgC,EAAE,CAC/E,CAAC,IAA6B,aAA7B,IAAI,uBAAJ,IAAI,CAA2B,gBAAgB,MAAK,SAAS,CAAC;AADnD,QAAA,mBAAmB,uBACgC;AAKzD,MAAM,UAAU,GAAG,CAAC,IAAU,EAAuB,EAAE,CAAC,CAAC,IAAoB,aAApB,IAAI,uBAAJ,IAAI,CAAkB,OAAO,MAAK,SAAS,CAAC;AAA/F,QAAA,UAAU,cAAqF;AAQrG,MAAM,iBAAiB,GAAG,CAAC,IAAU,EAA8B,EAAE,CAC3E,CAAC,IAA2B,aAA3B,IAAI,uBAAJ,IAAI,CAAyB,cAAc,MAAK,SAAS,CAAC;AAD/C,QAAA,iBAAiB,qBAC8B","sourcesContent":["import { BgsPlayerEntity, BgsQuestEntity, BoardTrinket } from '../bgs-player-entity';\r\nimport { BoardEntity } from '../board-entity';\r\nimport { BoardSecret } from '../board-secret';\r\nimport { OnDivineShieldUpdatedInput } from '../keywords/divine-shield';\r\nimport { OnRebornUpdatedInput } from '../keywords/reborn';\r\nimport { OnStealthUpdatedInput } from '../keywords/stealth';\r\nimport { OnTauntUpdatedInput } from '../keywords/taunt';\r\nimport { OnVenomousUpdatedInput } from '../keywords/venomous';\r\nimport { OnWindfuryUpdatedInput } from '../keywords/windfury';\r\nimport {\r\n\tOnDespawnInput,\r\n\tOnOtherSpawnAuraInput,\r\n\tOnOtherSpawnInput,\r\n\tOnSpawnInput,\r\n} from '../simulation/add-minion-to-board';\r\nimport { OnDeathInput, OnMinionKilledInput } from '../simulation/attack';\r\nimport { AvengeInput } from '../simulation/avenge';\r\nimport { BattlecryInput, OnBattlecryTriggeredInput } from '../simulation/battlecries';\r\nimport { OnCardAddedToHandInput } from '../simulation/cards-in-hand';\r\nimport { AfterHeroDamagedInput } from '../simulation/damage-to-hero';\r\nimport { DeathrattleTriggeredInput } from '../simulation/deathrattle-on-trigger';\r\nimport { OnAttackInput } from '../simulation/on-attack';\r\nimport { RebornEffectInput } from '../simulation/reborn';\r\nimport { SoCInput } from '../simulation/start-of-combat/start-of-combat-input';\r\nimport { OnStatsChangedInput } from '../simulation/stats';\r\n\r\nexport interface Card {\r\n\t// Maybe should make this mandatory\r\n\tcardIds?: readonly string[];\r\n\tstartOfCombat?: (\r\n\t\ttrinket: BoardEntity | BoardTrinket | BgsPlayerEntity | BoardSecret,\r\n\t\tinput: SoCInput,\r\n\t) => boolean | { hasTriggered: boolean; shouldRecomputeCurrentAttacker: boolean };\r\n}\r\n\r\nexport interface DefaultChargesCard extends Card {\r\n\tdefaultCharges: (entity: BoardEntity) => number;\r\n}\r\nexport const hasDefaultCharges = (card: Card): card is DefaultChargesCard =>\r\n\t(card as DefaultChargesCard)?.defaultCharges !== undefined;\r\n\r\nexport interface StartOfCombatCard extends Card {\r\n\tstartOfCombatTiming?: StartOfCombatTiming;\r\n\tstartOfCombat: NonNullable<Card['startOfCombat']>;\r\n}\r\nexport const hasStartOfCombat = (card: Card): card is StartOfCombatCard =>\r\n\t(card as StartOfCombatCard)?.startOfCombat !== undefined;\r\nexport type StartOfCombatTiming = 'start-of-combat' | 'pre-combat' | 'illidan';\r\n\r\n// Whenever this attacks\r\nexport interface OnAttackCard extends Card {\r\n\tonAnyMinionAttack: (\r\n\t\tminion: BoardEntity,\r\n\t\tinput: OnAttackInput,\r\n\t) => { dmgDoneByAttacker: number; dmgDoneByDefender: number };\r\n}\r\nexport const hasOnAttack = (card: Card): card is OnAttackCard =>\r\n\t(card as OnAttackCard)?.onAnyMinionAttack !== undefined;\r\n\r\nexport interface OnSpawnedCard extends Card {\r\n\tonSpawned: (minion: BoardEntity, input: OnSpawnInput) => void;\r\n}\r\nexport const hasOnSpawned = (card: Card): card is OnSpawnedCard => (card as OnSpawnedCard)?.onSpawned !== undefined;\r\n\r\nexport interface OnOtherSpawnedAuraCard extends Card {\r\n\tonOtherSpawnedAura: (minion: BoardEntity, input: OnOtherSpawnAuraInput) => void;\r\n}\r\nexport const hasOnOtherAuraSpawned = (card: Card): card is OnOtherSpawnedAuraCard =>\r\n\t(card as OnOtherSpawnedAuraCard)?.onOtherSpawnedAura !== undefined;\r\n\r\nexport interface OnOtherSpawnedCard extends Card {\r\n\tonOtherSpawned: (minion: BoardEntity, input: OnOtherSpawnInput) => void;\r\n}\r\nexport const hasOnOtherSpawned = (card: Card): card is OnOtherSpawnedCard =>\r\n\t(card as OnOtherSpawnedCard)?.onOtherSpawned !== undefined;\r\n\r\nexport interface AfterOtherSpawnedCard extends Card {\r\n\tafterOtherSpawned: (minion: BoardEntity, input: OnOtherSpawnInput) => void;\r\n}\r\nexport const hasAfterOtherSpawned = (card: Card): card is AfterOtherSpawnedCard =>\r\n\t(card as AfterOtherSpawnedCard)?.afterOtherSpawned !== undefined;\r\n\r\nexport interface OnDespawnedCard extends Card {\r\n\tonDespawned: (minion: BoardEntity, input: OnDespawnInput) => void;\r\n}\r\nexport const hasOnDespawned = (card: Card): card is OnDespawnedCard =>\r\n\t(card as OnDespawnedCard)?.onDespawned !== undefined;\r\n\r\nexport interface DeathrattleSpawnCard extends Card {\r\n\tdeathrattleSpawn: (minion: BoardEntity, input: DeathrattleTriggeredInput) => readonly BoardEntity[];\r\n}\r\nexport const hasDeathrattleSpawn = (card: Card): card is DeathrattleSpawnCard =>\r\n\t(card as DeathrattleSpawnCard)?.deathrattleSpawn !== undefined;\r\n\r\nexport interface BattlecryCard extends Card {\r\n\tbattlecry: (minion: BoardEntity, input: BattlecryInput) => void;\r\n}\r\nexport const hasBattlecry = (card: Card): card is BattlecryCard => (card as BattlecryCard)?.battlecry !== undefined;\r\n\r\nexport interface RebornEffectCard extends Card {\r\n\trebornEffect: (minion: BoardEntity, input: RebornEffectInput) => void;\r\n}\r\nexport const hasRebornEffect = (card: Card): card is RebornEffectCard =>\r\n\t(card as RebornEffectCard)?.rebornEffect !== undefined;\r\n\r\nexport interface OnBattlecryTriggeredCard extends Card {\r\n\tonBattlecryTriggered: (minion: BoardEntity, input: OnBattlecryTriggeredInput) => void;\r\n}\r\nexport const hasOnBattlecryTriggered = (card: Card): card is OnBattlecryTriggeredCard =>\r\n\t(card as OnBattlecryTriggeredCard)?.onBattlecryTriggered !== undefined;\r\n\r\nexport interface AvengeCard extends Card {\r\n\tavenge: (minion: BoardEntity, input: AvengeInput) => void | readonly BoardEntity[];\r\n\tbaseAvengeValue: (cardId: string) => number;\r\n}\r\nexport const hasAvenge = (card: Card): card is AvengeCard => (card as AvengeCard)?.avenge !== undefined;\r\n\r\nexport interface DeathrattleEffectCard extends Card {\r\n\tdeathrattleEffect: (minion: BoardEntity, input: DeathrattleTriggeredInput) => void;\r\n}\r\nexport const hasDeathrattleEffect = (card: Card): card is DeathrattleEffectCard =>\r\n\t(card as DeathrattleEffectCard)?.deathrattleEffect !== undefined;\r\n\r\nexport interface DeathrattleEnchantmentEffectCard extends Card {\r\n\tdeathrattleEffectEnchantmentEffect: (\r\n\t\tminion: { cardId: string; originEntityId?: number; repeats?: number },\r\n\t\tinput: DeathrattleTriggeredInput,\r\n\t) => void;\r\n\tcardIds: readonly string[];\r\n}\r\nexport const hasDeathrattleEnchantmentEffect = (card: Card): card is DeathrattleEnchantmentEffectCard =>\r\n\t(card as DeathrattleEnchantmentEffectCard)?.deathrattleEffectEnchantmentEffect !== undefined;\r\n\r\nexport interface DeathrattleSpawnEnchantmentCard extends Card {\r\n\tdeathrattleSpawnEnchantmentEffect: (\r\n\t\tminion: { cardId: string; originEntityId?: number; repeats?: number },\r\n\t\tinput: DeathrattleTriggeredInput,\r\n\t) => readonly BoardEntity[];\r\n\tcardIds: readonly string[];\r\n}\r\nexport const hasDeathrattleSpawnEnchantment = (card: Card): card is DeathrattleSpawnEnchantmentCard =>\r\n\t(card as DeathrattleSpawnEnchantmentCard)?.deathrattleSpawnEnchantmentEffect !== undefined;\r\n\r\nexport interface OnCardAddedToHandCard extends Card {\r\n\tonCardAddedToHand: (entity: BoardEntity | BgsQuestEntity, input: OnCardAddedToHandInput) => void;\r\n}\r\nexport const hasOnCardAddedToHand = (card: Card): card is OnCardAddedToHandCard =>\r\n\t(card as OnCardAddedToHandCard)?.onCardAddedToHand !== undefined;\r\n\r\nexport interface EndOfTurnCard extends Card {\r\n\t// Use BattlecryInput because it's the only way end of turn effects are triggered\r\n\tendOfTurn: (entity: BoardEntity, input: EndOfTurnInput) => void;\r\n}\r\nexport const hasEndOfTurn = (card: Card): card is EndOfTurnCard => (card as EndOfTurnCard)?.endOfTurn !== undefined;\r\nexport type EndOfTurnInput = BattlecryInput;\r\n\r\nexport interface OnDivineShieldUpdatedCard extends Card {\r\n\tonDivineShieldUpdated: (entity: BoardEntity, input: OnDivineShieldUpdatedInput) => void;\r\n}\r\nexport const hasOnDivineShieldUpdated = (card: Card): card is OnDivineShieldUpdatedCard =>\r\n\t(card as OnDivineShieldUpdatedCard)?.onDivineShieldUpdated !== undefined;\r\n\r\nexport interface OnTauntUpdatedCard extends Card {\r\n\tonTauntUpdated: (\r\n\t\tentity: BoardEntity,\r\n\t\timpactedEntity: BoardEntity,\r\n\t\tpreviousValue: boolean,\r\n\t\tinput: OnTauntUpdatedInput,\r\n\t) => void;\r\n}\r\nexport const hasOnTauntUpdated = (card: Card): card is OnTauntUpdatedCard =>\r\n\t(card as OnTauntUpdatedCard)?.onTauntUpdated !== undefined;\r\n\r\nexport interface OnRebornUpdatedCard extends Card {\r\n\tonRebornUpdated: (\r\n\t\tentity: BoardEntity,\r\n\t\timpactedEntity: BoardEntity,\r\n\t\tpreviousValue: boolean,\r\n\t\tinput: OnRebornUpdatedInput,\r\n\t) => void;\r\n}\r\nexport const hasOnRebornUpdated = (card: Card): card is OnRebornUpdatedCard =>\r\n\t(card as OnRebornUpdatedCard)?.onRebornUpdated !== undefined;\r\n\r\nexport interface OnStealthUpdatedCard extends Card {\r\n\tonStealthUpdated: (\r\n\t\tentity: BoardEntity,\r\n\t\timpactedEntity: BoardEntity,\r\n\t\tpreviousValue: boolean,\r\n\t\tinput: OnStealthUpdatedInput,\r\n\t) => void;\r\n}\r\nexport const hasOnStealthUpdated = (card: Card): card is OnStealthUpdatedCard =>\r\n\t(card as OnStealthUpdatedCard)?.onStealthUpdated !== undefined;\r\n\r\nexport interface OnVenomousUpdatedCard extends Card {\r\n\tonVenomousUpdated: (\r\n\t\tentity: BoardEntity,\r\n\t\timpactedEntity: BoardEntity,\r\n\t\tpreviousValue: boolean,\r\n\t\tinput: OnVenomousUpdatedInput,\r\n\t) => void;\r\n}\r\nexport const hasOnVenomousUpdated = (card: Card): card is OnVenomousUpdatedCard =>\r\n\t(card as OnVenomousUpdatedCard)?.onVenomousUpdated !== undefined;\r\n\r\nexport interface OnWindfuryUpdatedCard extends Card {\r\n\tonWindfuryUpdated: (\r\n\t\tentity: BoardEntity,\r\n\t\timpactedEntity: BoardEntity,\r\n\t\tpreviousValue: boolean,\r\n\t\tinput: OnWindfuryUpdatedInput,\r\n\t) => void;\r\n}\r\nexport const hasOnWindfuryUpdated = (card: Card): card is OnWindfuryUpdatedCard =>\r\n\t(card as OnWindfuryUpdatedCard)?.onWindfuryUpdated !== undefined;\r\n\r\nexport interface OnStatsChangedCard extends Card {\r\n\tonStatsChanged: (entity: BoardEntity, input: OnStatsChangedInput) => void;\r\n}\r\nexport const hasOnStatsChanged = (card: Card): card is OnStatsChangedCard =>\r\n\t(card as OnStatsChangedCard)?.onStatsChanged !== undefined;\r\n\r\nexport interface AfterHeroDamagedCard extends Card {\r\n\tafterHeroDamaged: (entity: BoardEntity, input: AfterHeroDamagedInput) => void;\r\n}\r\nexport const hasAfterHeroDamaged = (card: Card): card is AfterHeroDamagedCard =>\r\n\t(card as AfterHeroDamagedCard)?.afterHeroDamaged !== undefined;\r\n\r\nexport interface OnDeathCard extends Card {\r\n\tonDeath: (entity: BoardEntity, input: OnDeathInput) => void;\r\n}\r\nexport const hasOnDeath = (card: Card): card is OnDeathCard => (card as OnDeathCard)?.onDeath !== undefined;\r\n\r\nexport interface OnMinionKilledCard extends Card {\r\n\tonMinionKilled: (\r\n\t\tentity: BoardEntity,\r\n\t\tinput: OnMinionKilledInput,\r\n\t) => { dmgDoneByAttacker: number; dmgDoneByDefender: number };\r\n}\r\nexport const hasOnMinionKilled = (card: Card): card is OnMinionKilledCard =>\r\n\t(card as OnMinionKilledCard)?.onMinionKilled !== undefined;\r\n"]}
|
|
@@ -8,7 +8,9 @@ exports.Battlecruiser = {
|
|
|
8
8
|
cardIds: ["BG31_HERO_801pt", "BG31_HERO_801pt_G"],
|
|
9
9
|
startOfCombat: (minion, input) => {
|
|
10
10
|
var _a;
|
|
11
|
-
const yamatoCannon = (_a = minion.enchantments)
|
|
11
|
+
const yamatoCannon = [...((_a = minion.enchantments) !== null && _a !== void 0 ? _a : [])]
|
|
12
|
+
.reverse()
|
|
13
|
+
.find((e) => e.cardId === "BG31_HERO_801ptce");
|
|
12
14
|
if (!yamatoCannon) {
|
|
13
15
|
return false;
|
|
14
16
|
}
|
|
@@ -27,7 +29,9 @@ exports.Battlecruiser = {
|
|
|
27
29
|
},
|
|
28
30
|
rebornEffect: (minion, input) => {
|
|
29
31
|
var _a;
|
|
30
|
-
const ultraCapacitor = (_a = input.initialEntity.enchantments)
|
|
32
|
+
const ultraCapacitor = [...((_a = input.initialEntity.enchantments) !== null && _a !== void 0 ? _a : [])]
|
|
33
|
+
.reverse()
|
|
34
|
+
.find((e) => e.cardId === "BG31_HERO_801ptje");
|
|
31
35
|
if (!ultraCapacitor) {
|
|
32
36
|
return;
|
|
33
37
|
}
|
|
@@ -46,7 +50,9 @@ exports.Battlecruiser = {
|
|
|
46
50
|
if (minion !== input.attacker) {
|
|
47
51
|
return { dmgDoneByAttacker: 0, dmgDoneByDefender: 0 };
|
|
48
52
|
}
|
|
49
|
-
const advancedBallistics = (_a = minion.enchantments)
|
|
53
|
+
const advancedBallistics = [...((_a = minion.enchantments) !== null && _a !== void 0 ? _a : [])]
|
|
54
|
+
.reverse()
|
|
55
|
+
.find((e) => e.cardId === "BG31_HERO_801ptde");
|
|
50
56
|
if (!advancedBallistics) {
|
|
51
57
|
return { dmgDoneByAttacker: 0, dmgDoneByDefender: 0 };
|
|
52
58
|
}
|
|
@@ -59,16 +65,19 @@ exports.Battlecruiser = {
|
|
|
59
65
|
},
|
|
60
66
|
deathrattleEffect: (minion, input) => {
|
|
61
67
|
var _a;
|
|
62
|
-
const caduceusReactor = (_a = minion.enchantments)
|
|
68
|
+
const caduceusReactor = [...((_a = minion.enchantments) !== null && _a !== void 0 ? _a : [])]
|
|
69
|
+
.reverse()
|
|
70
|
+
.find((e) => e.cardId === "BG31_HERO_801ptee");
|
|
63
71
|
if (!caduceusReactor) {
|
|
64
72
|
return;
|
|
65
73
|
}
|
|
66
|
-
const target = input.boardWithDeadEntity[0];
|
|
74
|
+
const target = input.boardWithDeadEntity.filter((e) => e.health > 0 && !e.definitelyDead)[0];
|
|
67
75
|
if (!target) {
|
|
68
76
|
return;
|
|
69
77
|
}
|
|
70
78
|
const buff = caduceusReactor.tagScriptDataNum1;
|
|
71
79
|
(0, stats_1.modifyStats)(target, buff, buff, input.boardWithDeadEntity, input.boardWithDeadEntityHero, input.gameState);
|
|
80
|
+
input.gameState.spectator.registerPowerTarget(minion, target, input.boardWithDeadEntity, input.boardWithDeadEntityHero, input.otherBoardHero);
|
|
72
81
|
},
|
|
73
82
|
};
|
|
74
83
|
//# sourceMappingURL=battlecruiser.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"battlecruiser.js","sourceRoot":"","sources":["../../../../src/cards/impl/minion/battlecruiser.ts"],"names":[],"mappings":";;;AAEA,uDAAgE;AAKhE,qDAAwD;AACxD,0CAAkE;AAGrD,QAAA,aAAa,GAAgF;IACzG,OAAO,EAAE,wCAA6F;IACtG,aAAa,EAAE,CAAC,MAAmB,EAAE,KAAe,EAAE,EAAE;;
|
|
1
|
+
{"version":3,"file":"battlecruiser.js","sourceRoot":"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ED,MAAM,IAAI,GAAG,eAAe,CAAC,iBAAiB,CAAC;QAC/C,IAAA,mBAAW,EAAC,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,CAAC,mBAAmB,EAAE,KAAK,CAAC,uBAAuB,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;QAC3G,KAAK,CAAC,SAAS,CAAC,SAAS,CAAC,mBAAmB,CAC5C,MAAM,EACN,MAAM,EACN,KAAK,CAAC,mBAAmB,EACzB,KAAK,CAAC,uBAAuB,EAC7B,KAAK,CAAC,cAAc,CACpB,CAAC;IACH,CAAC;CACD,CAAC","sourcesContent":["import { CardIds } from '@firestone-hs/reference-data';\r\nimport { BoardEntity } from '../../../board-entity';\r\nimport { dealDamageToMinion } from '../../../simulation/attack';\r\nimport { DeathrattleTriggeredInput } from '../../../simulation/deathrattle-on-trigger';\r\nimport { OnAttackInput } from '../../../simulation/on-attack';\r\nimport { RebornEffectInput } from '../../../simulation/reborn';\r\nimport { SoCInput } from '../../../simulation/start-of-combat/start-of-combat-input';\r\nimport { modifyStats } from '../../../simulation/stats';\r\nimport { getRandomMinionWithHighestHealth } from '../../../utils';\r\nimport { DeathrattleEffectCard, OnAttackCard, RebornEffectCard, StartOfCombatCard } from '../../card.interface';\r\n\r\nexport const Battlecruiser: StartOfCombatCard & RebornEffectCard & OnAttackCard & DeathrattleEffectCard = {\r\n\tcardIds: [CardIds.LiftOff_BattlecruiserToken_BG31_HERO_801pt, CardIds.Battlecruiser_BG31_HERO_801pt_G],\r\n\tstartOfCombat: (minion: BoardEntity, input: SoCInput) => {\r\n\t\t// Enchantments can appear multiple times???\r\n\t\tconst yamatoCannon = [...(minion.enchantments ?? [])]\r\n\t\t\t.reverse()\r\n\t\t\t.find((e) => e.cardId === CardIds.YamatoCannon_YamatoCannonEnchantment_BG31_HERO_801ptce);\r\n\t\tif (!yamatoCannon) {\r\n\t\t\treturn false;\r\n\t\t}\r\n\r\n\t\tconst damage = yamatoCannon.tagScriptDataNum1;\r\n\t\tconst target = getRandomMinionWithHighestHealth(input.opponentBoard);\r\n\t\tif (!!target) {\r\n\t\t\tconst loops = !!minion.enchantments.find(\r\n\t\t\t\t(e) => e.cardId === CardIds.Battlecruiser_MissilePod_BG31_HERO_801pti,\r\n\t\t\t)\r\n\t\t\t\t? 2\r\n\t\t\t\t: 1;\r\n\t\t\tfor (let i = 0; i < loops; i++) {\r\n\t\t\t\tdealDamageToMinion(\r\n\t\t\t\t\ttarget,\r\n\t\t\t\t\tinput.opponentBoard,\r\n\t\t\t\t\tinput.opponentEntity,\r\n\t\t\t\t\tminion,\r\n\t\t\t\t\tdamage,\r\n\t\t\t\t\tinput.playerBoard,\r\n\t\t\t\t\tinput.playerEntity,\r\n\t\t\t\t\tinput.gameState,\r\n\t\t\t\t);\r\n\t\t\t\tinput.gameState.spectator.registerPowerTarget(\r\n\t\t\t\t\tminion,\r\n\t\t\t\t\ttarget,\r\n\t\t\t\t\tinput.opponentBoard,\r\n\t\t\t\t\tinput.playerEntity,\r\n\t\t\t\t\tinput.opponentEntity,\r\n\t\t\t\t);\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn true;\r\n\t},\r\n\trebornEffect: (minion: BoardEntity, input: RebornEffectInput) => {\r\n\t\tconst ultraCapacitor = [...(input.initialEntity.enchantments ?? [])]\r\n\t\t\t.reverse()\r\n\t\t\t.find((e) => e.cardId === CardIds.UltraCapacitor_UltraCapacitorEnchantment_BG31_HERO_801ptje);\r\n\t\tif (!ultraCapacitor) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tminion.enchantments = input.initialEntity.enchantments;\r\n\t\tminion.attack = input.initialEntity.maxAttack;\r\n\t\tminion.maxAttack = input.initialEntity.maxAttack;\r\n\t\tminion.health = input.initialEntity.maxHealth;\r\n\t\tminion.maxHealth = input.initialEntity.maxHealth;\r\n\t\tminion.divineShield = input.initialEntity.hadDivineShield;\r\n\t\tminion.taunt = input.initialEntity.taunt;\r\n\t\tminion.windfury = input.initialEntity.windfury;\r\n\t\tminion.poisonous = input.initialEntity.poisonous;\r\n\t},\r\n\tonAnyMinionAttack: (\r\n\t\tminion: BoardEntity,\r\n\t\tinput: OnAttackInput,\r\n\t): {\r\n\t\tdmgDoneByAttacker: number;\r\n\t\tdmgDoneByDefender: number;\r\n\t} => {\r\n\t\tif (minion !== input.attacker) {\r\n\t\t\treturn { dmgDoneByAttacker: 0, dmgDoneByDefender: 0 };\r\n\t\t}\r\n\r\n\t\tconst advancedBallistics = [...(minion.enchantments ?? [])]\r\n\t\t\t.reverse()\r\n\t\t\t.find((e) => e.cardId === CardIds.AdvancedBallistics_AdvancedBallisticsEnchantment_BG31_HERO_801ptde);\r\n\t\tif (!advancedBallistics) {\r\n\t\t\treturn { dmgDoneByAttacker: 0, dmgDoneByDefender: 0 };\r\n\t\t}\r\n\r\n\t\tconst buff = advancedBallistics.tagScriptDataNum1;\r\n\t\tconst targets = input.attackingBoard.filter((entity) => entity !== minion);\r\n\t\tfor (const target of targets) {\r\n\t\t\tmodifyStats(target, buff, 0, input.attackingBoard, input.attackingHero, input.gameState);\r\n\t\t}\r\n\t\treturn { dmgDoneByAttacker: 0, dmgDoneByDefender: 0 };\r\n\t},\r\n\tdeathrattleEffect: (minion: BoardEntity, input: DeathrattleTriggeredInput) => {\r\n\t\tconst caduceusReactor = [...(minion.enchantments ?? [])]\r\n\t\t\t.reverse()\r\n\t\t\t.find((e) => e.cardId === CardIds.CaduceusReactor_CaduceusReactorEnchantment_BG31_HERO_801ptee);\r\n\t\tif (!caduceusReactor) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tconst target = input.boardWithDeadEntity.filter((e) => e.health > 0 && !e.definitelyDead)[0];\r\n\t\tif (!target) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tconst buff = caduceusReactor.tagScriptDataNum1;\r\n\t\tmodifyStats(target, buff, buff, input.boardWithDeadEntity, input.boardWithDeadEntityHero, input.gameState);\r\n\t\tinput.gameState.spectator.registerPowerTarget(\r\n\t\t\tminion,\r\n\t\t\ttarget,\r\n\t\t\tinput.boardWithDeadEntity,\r\n\t\t\tinput.boardWithDeadEntityHero,\r\n\t\t\tinput.otherBoardHero,\r\n\t\t);\r\n\t},\r\n};\r\n"]}
|
|
@@ -10,7 +10,7 @@ exports.BellowingTyrant = {
|
|
|
10
10
|
input.hero.globalInfo.BeastsSummonedThisGame += 1;
|
|
11
11
|
const mult = minion.cardId === "BG31_361_G" ? 2 : 1;
|
|
12
12
|
const statsBonus = mult * input.hero.globalInfo.BeastsSummonedThisGame;
|
|
13
|
-
(0, stats_1.modifyStats)(minion, 3 * statsBonus, 2 *
|
|
13
|
+
(0, stats_1.modifyStats)(minion, 3 * statsBonus, 2 * statsBonus, input.board, input.hero, input.gameState);
|
|
14
14
|
},
|
|
15
15
|
onOtherSpawned: (minion, input) => {
|
|
16
16
|
if (!(0, utils_1.hasCorrectTribe)(input.spawned, input.hero, reference_data_1.Race.BEAST, input.gameState.allCards)) {
|
|
@@ -19,7 +19,7 @@ exports.BellowingTyrant = {
|
|
|
19
19
|
input.hero.globalInfo.BeastsSummonedThisGame += 1;
|
|
20
20
|
const mult = minion.cardId === "BG31_361_G" ? 2 : 1;
|
|
21
21
|
const statsBonus = mult * 1;
|
|
22
|
-
(0, stats_1.modifyStats)(minion, 3 * statsBonus, 2 *
|
|
22
|
+
(0, stats_1.modifyStats)(minion, 3 * statsBonus, 2 * statsBonus, input.board, input.hero, input.gameState);
|
|
23
23
|
},
|
|
24
24
|
};
|
|
25
25
|
//# sourceMappingURL=bellowing-tyrant.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bellowing-tyrant.js","sourceRoot":"","sources":["../../../../src/cards/impl/minion/bellowing-tyrant.ts"],"names":[],"mappings":";;;AAAA,iEAA6D;AAG7D,qDAAwD;AACxD,0CAAiD;AAGpC,QAAA,eAAe,GAAuC;IAClE,OAAO,EAAE,0BAAsE;IAC/E,SAAS,EAAE,CAAC,MAAmB,E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AC,SAAS,CAAC,QAAQ,CAAC,EAAE;YACtF,OAAO;SACP;QACD,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,sBAAsB,IAAI,CAAC,CAAC;QAClD,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,iBAAuC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAC1E,MAAM,UAAU,GAAG,IAAI,GAAG,CAAC,CAAC;QAC5B,IAAA,mBAAW,EAAC,MAAM,EAAE,CAAC,GAAG,UAAU,EAAE,CAAC,GAAG,UAAU,EAAE,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;IAC/F,CAAC;CACD,CAAC","sourcesContent":["import { CardIds, Race } from '@firestone-hs/reference-data';\r\nimport { BoardEntity } from '../../../board-entity';\r\nimport { OnOtherSpawnInput, OnSpawnInput } from '../../../simulation/add-minion-to-board';\r\nimport { modifyStats } from '../../../simulation/stats';\r\nimport { hasCorrectTribe } from '../../../utils';\r\nimport { OnOtherSpawnedCard, OnSpawnedCard } from '../../card.interface';\r\n\r\nexport const BellowingTyrant: OnSpawnedCard & OnOtherSpawnedCard = {\r\n\tcardIds: [CardIds.BellowingTyrant_BG31_361, CardIds.BellowingTyrant_BG31_361_G],\r\n\tonSpawned: (minion: BoardEntity, input: OnSpawnInput) => {\r\n\t\tinput.hero.globalInfo.BeastsSummonedThisGame += 1;\r\n\t\tconst mult = minion.cardId === CardIds.BellowingTyrant_BG31_361_G ? 2 : 1;\r\n\t\tconst statsBonus = mult * input.hero.globalInfo.BeastsSummonedThisGame;\r\n\t\tmodifyStats(minion, 3 * statsBonus, 2 * statsBonus, input.board, input.hero, input.gameState);\r\n\t},\r\n\tonOtherSpawned: (minion: BoardEntity, input: OnOtherSpawnInput) => {\r\n\t\tif (!hasCorrectTribe(input.spawned, input.hero, Race.BEAST, input.gameState.allCards)) {\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tinput.hero.globalInfo.BeastsSummonedThisGame += 1;\r\n\t\tconst mult = minion.cardId === CardIds.BellowingTyrant_BG31_361_G ? 2 : 1;\r\n\t\tconst statsBonus = mult * 1;\r\n\t\tmodifyStats(minion, 3 * statsBonus, 2 * statsBonus, input.board, input.hero, input.gameState);\r\n\t},\r\n};\r\n"]}
|
|
@@ -4,7 +4,7 @@ exports.Carrier = void 0;
|
|
|
4
4
|
const deathrattle_spawns_1 = require("../../../simulation/deathrattle-spawns");
|
|
5
5
|
const stats_1 = require("../../../simulation/stats");
|
|
6
6
|
exports.Carrier = {
|
|
7
|
-
cardIds: ["
|
|
7
|
+
cardIds: ["BG31_HERO_802pt1", "BG31_HERO_802pt1_G"],
|
|
8
8
|
baseAvengeValue: (cardId) => 4,
|
|
9
9
|
avenge: (minion, input) => {
|
|
10
10
|
const spawnInput = {
|
|
@@ -19,8 +19,9 @@ exports.Carrier = {
|
|
|
19
19
|
const numberOfSummons = minion.cardId === "BG31_HERO_802pt1_G" ? 2 : 1;
|
|
20
20
|
const spawned = (0, deathrattle_spawns_1.simplifiedSpawnEntities)("BG31_HERO_802pt1t", numberOfSummons, spawnInput);
|
|
21
21
|
spawned.forEach((e) => {
|
|
22
|
-
(0, stats_1.modifyStats)(e, statBuff
|
|
22
|
+
(0, stats_1.modifyStats)(e, statBuff, statBuff, input.board, input.hero, input.gameState);
|
|
23
23
|
});
|
|
24
|
+
return spawned;
|
|
24
25
|
},
|
|
25
26
|
};
|
|
26
27
|
//# sourceMappingURL=carrier.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"carrier.js","sourceRoot":"","sources":["../../../../src/cards/impl/minion/carrier.ts"],"names":[],"mappings":";;;AAIA,+EAAiF;AACjF,qDAAwD;AAG3C,QAAA,OAAO,GAAe;IAClC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"carrier.js","sourceRoot":"","sources":["../../../../src/cards/impl/minion/carrier.ts"],"names":[],"mappings":";;;AAIA,+EAAiF;AACjF,qDAAwD;AAG3C,QAAA,OAAO,GAAe;IAClC,OAAO,EAAE,0CAAoF;IAC7F,eAAe,EAAE,CAAC,MAAc,EAAE,EAAE,CAAC,CAAC;IACtC,MAAM,EAAE,CAAC,MAAmB,EAAE,KAAkB,EAA0B,EAAE;QAC3E,MAAM,UAAU,GAA8B;YAC7C,mBAAmB,EAAE,KAAK,CAAC,KAAK;YAChC,uBAAuB,EAAE,KAAK,CAAC,IAAI;YACnC,SAAS,EAAE,KAAK,CAAC,SAAS;YAC1B,UAAU,EAAE,MAAM;YAClB,UAAU,EAAE,KAAK,CAAC,UAAU;YAC5B,cAAc,EAAE,KAAK,CAAC,SAAS;SAC/B,CAAC;QACF,MAAM,QAAQ,GAAG,MAAM,CAAC,cAAc,CAAC;QACvC,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,yBAAuC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACrF,MAAM,OAAO,GAAG,IAAA,4CAAuB,uBAEtC,eAAe,EACf,UAAU,CACV,CAAC;QACF,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE;YACrB,IAAA,mBAAW,EAAC,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;QAC9E,CAAC,CAAC,CAAC;QACH,OAAO,OAAO,CAAC;IAChB,CAAC;CACD,CAAC","sourcesContent":["import { CardIds } from '@firestone-hs/reference-data';\r\nimport { BoardEntity } from '../../../board-entity';\r\nimport { AvengeInput } from '../../../simulation/avenge';\r\nimport { DeathrattleTriggeredInput } from '../../../simulation/deathrattle-on-trigger';\r\nimport { simplifiedSpawnEntities } from '../../../simulation/deathrattle-spawns';\r\nimport { modifyStats } from '../../../simulation/stats';\r\nimport { AvengeCard } from '../../card.interface';\r\n\r\nexport const Carrier: AvengeCard = {\r\n\tcardIds: [CardIds.WarpGate_CarrierToken_BG31_HERO_802pt1, CardIds.Carrier_BG31_HERO_802pt1_G],\r\n\tbaseAvengeValue: (cardId: string) => 4,\r\n\tavenge: (minion: BoardEntity, input: AvengeInput): readonly BoardEntity[] => {\r\n\t\tconst spawnInput: DeathrattleTriggeredInput = {\r\n\t\t\tboardWithDeadEntity: input.board,\r\n\t\t\tboardWithDeadEntityHero: input.hero,\r\n\t\t\tgameState: input.gameState,\r\n\t\t\tdeadEntity: minion, // weird\r\n\t\t\totherBoard: input.otherBoard,\r\n\t\t\totherBoardHero: input.otherHero,\r\n\t\t};\r\n\t\tconst statBuff = minion.scriptDataNum1;\r\n\t\tconst numberOfSummons = minion.cardId === CardIds.Carrier_BG31_HERO_802pt1_G ? 2 : 1;\r\n\t\tconst spawned = simplifiedSpawnEntities(\r\n\t\t\tCardIds.Carrier_InterceptorToken_BG31_HERO_802pt1t,\r\n\t\t\tnumberOfSummons,\r\n\t\t\tspawnInput,\r\n\t\t);\r\n\t\tspawned.forEach((e) => {\r\n\t\t\tmodifyStats(e, statBuff, statBuff, input.board, input.hero, input.gameState);\r\n\t\t});\r\n\t\treturn spawned;\r\n\t},\r\n};\r\n"]}
|
|
@@ -5,7 +5,7 @@ const stats_1 = require("../../../simulation/stats");
|
|
|
5
5
|
exports.Mutalisk = {
|
|
6
6
|
cardIds: ["BG31_HERO_811t6", "BG31_HERO_811t6_G"],
|
|
7
7
|
onMinionKilled: (minion, input) => {
|
|
8
|
-
if (
|
|
8
|
+
if (input.gameState.sharedState.currentAttackerEntityId !== minion.entityId) {
|
|
9
9
|
return { dmgDoneByAttacker: 0, dmgDoneByDefender: 0 };
|
|
10
10
|
}
|
|
11
11
|
const mult = minion.cardId === "BG31_HERO_811t6_G" ? 2 : 1;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mutalisk.js","sourceRoot":"","sources":["../../../../src/cards/impl/minion/mutalisk.ts"],"names":[],"mappings":";;;AAGA,qDAAwD;AAG3C,QAAA,QAAQ,GAAuB;IAC3C,OAAO,EAAE,wCAAiG;IAC1G,cAAc,EAAE,CACf,MAAmB,EACnB,KAA0B,EACiC,EAAE;QAC7D,IAAI,CAAC,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"mutalisk.js","sourceRoot":"","sources":["../../../../src/cards/impl/minion/mutalisk.ts"],"names":[],"mappings":";;;AAGA,qDAAwD;AAG3C,QAAA,QAAQ,GAAuB;IAC3C,OAAO,EAAE,wCAAiG;IAC1G,cAAc,EAAE,CACf,MAAmB,EACnB,KAA0B,EACiC,EAAE;QAC7D,IAAI,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,uBAAuB,KAAK,MAAM,CAAC,QAAQ,EAAE;YAC5E,OAAO,EAAE,iBAAiB,EAAE,CAAC,EAAE,iBAAiB,EAAE,CAAC,EAAE,CAAC;SACtD;QAED,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,wBAAuC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAC1E,IAAA,mBAAW,EAAC,MAAM,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC,GAAG,IAAI,EAAE,KAAK,CAAC,cAAc,EAAE,KAAK,CAAC,aAAa,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;QACpG,OAAO,EAAE,iBAAiB,EAAE,CAAC,EAAE,iBAAiB,EAAE,CAAC,EAAE,CAAC;IACvD,CAAC;CACD,CAAC","sourcesContent":["import { CardIds } from '@firestone-hs/reference-data';\r\nimport { BoardEntity } from '../../../board-entity';\r\nimport { OnMinionKilledInput } from '../../../simulation/attack';\r\nimport { modifyStats } from '../../../simulation/stats';\r\nimport { OnMinionKilledCard } from '../../card.interface';\r\n\r\nexport const Mutalisk: OnMinionKilledCard = {\r\n\tcardIds: [CardIds.KerriganQueenOfBlades_MutaliskToken_BG31_HERO_811t6, CardIds.Mutalisk_BG31_HERO_811t6_G],\r\n\tonMinionKilled: (\r\n\t\tminion: BoardEntity,\r\n\t\tinput: OnMinionKilledInput,\r\n\t): { dmgDoneByAttacker: number; dmgDoneByDefender: number } => {\r\n\t\tif (input.gameState.sharedState.currentAttackerEntityId !== minion.entityId) {\r\n\t\t\treturn { dmgDoneByAttacker: 0, dmgDoneByDefender: 0 };\r\n\t\t}\r\n\r\n\t\tconst mult = minion.cardId === CardIds.Mutalisk_BG31_HERO_811t6_G ? 2 : 1;\r\n\t\tmodifyStats(minion, 4 * mult, 4 * mult, input.attackingBoard, input.attackingHero, input.gameState);\r\n\t\treturn { dmgDoneByAttacker: 0, dmgDoneByDefender: 0 };\r\n\t},\r\n};\r\n"]}
|
|
@@ -5,7 +5,7 @@ const attack_1 = require("../../../simulation/attack");
|
|
|
5
5
|
exports.WildfireElemental = {
|
|
6
6
|
cardIds: ["BGS_126", "TB_BaconUps_166"],
|
|
7
7
|
onMinionKilled: (minion, input) => {
|
|
8
|
-
if (
|
|
8
|
+
if (input.gameState.sharedState.currentAttackerEntityId !== minion.entityId) {
|
|
9
9
|
return { dmgDoneByAttacker: 0, dmgDoneByDefender: 0 };
|
|
10
10
|
}
|
|
11
11
|
const excessDamage = -input.minionKilled.health;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wildfire-elemental.js","sourceRoot":"","sources":["../../../../src/cards/impl/minion/wildfire-elemental.ts"],"names":[],"mappings":";;;AAEA,uDAAqF;AAGxE,QAAA,iBAAiB,GAAuB;IACpD,OAAO,EAAE,8BAA8E;IACvF,cAAc,EAAE,CACf,MAAmB,EACnB,KAA0B,EACiC,EAAE;QAC7D,IAAI,CAAC,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"wildfire-elemental.js","sourceRoot":"","sources":["../../../../src/cards/impl/minion/wildfire-elemental.ts"],"names":[],"mappings":";;;AAEA,uDAAqF;AAGxE,QAAA,iBAAiB,GAAuB;IACpD,OAAO,EAAE,8BAA8E;IACvF,cAAc,EAAE,CACf,MAAmB,EACnB,KAA0B,EACiC,EAAE;QAC7D,IAAI,KAA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AAE,CAAC,EAAE,CAAC;IAC1E,CAAC;CACD,CAAC","sourcesContent":["import { CardIds } from '@firestone-hs/reference-data';\r\nimport { BoardEntity } from '../../../board-entity';\r\nimport { dealDamageToMinion, OnMinionKilledInput } from '../../../simulation/attack';\r\nimport { OnMinionKilledCard } from '../../card.interface';\r\n\r\nexport const WildfireElemental: OnMinionKilledCard = {\r\n\tcardIds: [CardIds.WildfireElemental_BGS_126, CardIds.WildfireElemental_TB_BaconUps_166],\r\n\tonMinionKilled: (\r\n\t\tminion: BoardEntity,\r\n\t\tinput: OnMinionKilledInput,\r\n\t): { dmgDoneByAttacker: number; dmgDoneByDefender: number } => {\r\n\t\tif (input.gameState.sharedState.currentAttackerEntityId !== minion.entityId) {\r\n\t\t\treturn { dmgDoneByAttacker: 0, dmgDoneByDefender: 0 };\r\n\t\t}\r\n\r\n\t\tconst excessDamage = -input.minionKilled.health;\r\n\t\tlet damageDoneByAttacker = 0;\r\n\t\t// console.log('neighbours', stringifySimple(neighbours, allCards));\r\n\t\tif (input.defenderNeighbours.length > 0) {\r\n\t\t\tif (minion.cardId === CardIds.WildfireElemental_BGS_126) {\r\n\t\t\t\tconst randomTarget =\r\n\t\t\t\t\tinput.defenderNeighbours[Math.floor(Math.random() * input.defenderNeighbours.length)];\r\n\t\t\t\tdamageDoneByAttacker += dealDamageToMinion(\r\n\t\t\t\t\trandomTarget,\r\n\t\t\t\t\tinput.defendingBoard,\r\n\t\t\t\t\tinput.defendingHero,\r\n\t\t\t\t\tinput.minionKilled.lastAffectedByEntity,\r\n\t\t\t\t\texcessDamage,\r\n\t\t\t\t\tinput.attackingBoard,\r\n\t\t\t\t\tinput.attackingHero,\r\n\t\t\t\t\tinput.gameState,\r\n\t\t\t\t);\r\n\t\t\t} else {\r\n\t\t\t\tdamageDoneByAttacker += input.defenderNeighbours\r\n\t\t\t\t\t.map((neighbour) =>\r\n\t\t\t\t\t\tdealDamageToMinion(\r\n\t\t\t\t\t\t\tneighbour,\r\n\t\t\t\t\t\t\tinput.defendingBoard,\r\n\t\t\t\t\t\t\tinput.defendingHero,\r\n\t\t\t\t\t\t\tinput.minionKilled.lastAffectedByEntity,\r\n\t\t\t\t\t\t\texcessDamage,\r\n\t\t\t\t\t\t\tinput.attackingBoard,\r\n\t\t\t\t\t\t\tinput.attackingHero,\r\n\t\t\t\t\t\t\tinput.gameState,\r\n\t\t\t\t\t\t),\r\n\t\t\t\t\t)\r\n\t\t\t\t\t.reduce((a, b) => a + b, 0);\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn { dmgDoneByAttacker: damageDoneByAttacker, dmgDoneByDefender: 0 };\r\n\t},\r\n};\r\n"]}
|
|
@@ -9,13 +9,16 @@ exports.Zergling = {
|
|
|
9
9
|
cardIds: ["BG31_HERO_811t2", "BG31_HERO_811t2_G"],
|
|
10
10
|
startOfCombat: (minion, input) => {
|
|
11
11
|
let hasTriggered = false;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
12
|
+
const loops = minion.cardId === "BG31_HERO_811t2_G" ? 2 : 1;
|
|
13
|
+
for (let i = 0; i < loops; i++) {
|
|
14
|
+
if (input.playerBoard.length < 7) {
|
|
15
|
+
const copy = (0, utils_1.copyEntity)(minion);
|
|
16
|
+
(0, add_minion_to_board_1.removeAurasFromSelf)(copy, input.playerBoard, input.playerEntity, input.gameState);
|
|
17
|
+
const newMinions = (0, deathrattle_spawns_1.spawnEntities)(copy.cardId, 1, input.playerBoard, input.playerEntity, input.opponentBoard, input.opponentEntity, input.gameState.allCards, input.gameState.cardsData, input.gameState.sharedState, input.gameState.spectator, input.playerEntity.friendly, false, false, false, copy);
|
|
18
|
+
const indexFromRight = input.playerBoard.length - input.playerBoard.indexOf(minion) - 1;
|
|
19
|
+
const spawns = (0, spawns_1.performEntitySpawns)(newMinions, input.playerBoard, input.playerEntity, input.playerEntity, indexFromRight, input.opponentBoard, input.opponentEntity, input.gameState);
|
|
20
|
+
hasTriggered = true;
|
|
21
|
+
}
|
|
19
22
|
}
|
|
20
23
|
return { hasTriggered: hasTriggered, shouldRecomputeCurrentAttacker: hasTriggered };
|
|
21
24
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zergling.js","sourceRoot":"","sources":["../../../../src/cards/impl/minion/zergling.ts"],"names":[],"mappings":";;;AAEA,iFAA8E;AAC9E,+EAAuE;AACvE,uDAAiE;AAEjE,0CAA4C;AAG/B,QAAA,QAAQ,GAAsB;IAC1C,OAAO,EAAE,wCAAiG;IAC1G,aAAa,EAAE,CAAC,MAAmB,EAAE,KAAe,EAAE,EAAE;QACvD,IAAI,YAAY,GAAG,KAAK,CAAC;QACzB,IAAI,KAAK,CAAC,WAAW,CAAC,MAAM,GAAG,CAAC,EAAE;
|
|
1
|
+
{"version":3,"file":"zergling.js","sourceRoot":"","sources":["../../../../src/cards/impl/minion/zergling.ts"],"names":[],"mappings":";;;AAEA,iFAA8E;AAC9E,+EAAuE;AACvE,uDAAiE;AAEjE,0CAA4C;AAG/B,QAAA,QAAQ,GAAsB;IAC1C,OAAO,EAAE,wCAAiG;IAC1G,aAAa,EAAE,CAAC,MAAmB,EAAE,KAAe,EAAE,EAAE;QACvD,IAAI,YAAY,GAAG,KAAK,CAAC;QACzB,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,wBAAuC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAC3E,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,EAAE,CAAC,EAAE,EAAE;YAC/B,IAAI,KAAK,CAAC,WAAW,CAAC,MAAM,GAAG,CAAC,EAAE;gBACjC,MAAM,IAAI,GAAG,IAAA,kBAAU,EAAC,MAAM,CAAC,CAAC;gBAChC,IAAA,yCAAmB,EAAC,IAAI,EAAE,KAAK,CAAC,WAAW,EAAE,KAAK,CAAC,YAAY,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;gBAClF,MAAM,UAAU,GAAG,IAAA,kCAAa,EAC/B,IAAI,CAAC,MAAM,EACX,CAAC,EACD,KAAK,CAAC,WAAW,EACjB,KAAK,CAAC,YAAY,EAClB,KAAK,CAAC,aAAa,EACnB,KAAK,CAAC,cAAc,EACpB,KAAK,CAAC,SAAS,CAAC,QAAQ,EACxB,KAAK,CAAC,SAAS,CAAC,SAAS,EACzB,KAAK,CAAC,SAAS,CAAC,WAAW,EAC3B,KAAK,CAAC,SAAS,CAAC,SAAS,EACzB,KAAK,CAAC,YAAY,CAAC,QAAQ,EAC3B,KAAK,EACL,KAAK,EACL,KAAK,EACL,IAAI,CACJ,CAAC;gBACF,MAAM,cAAc,GAAG,KAAK,CAAC,WAAW,CAAC,MAAM,GAAG,KAAK,CAAC,WAAW,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;gBACxF,MAAM,MAAM,GAAG,IAAA,4BAAmB,EACjC,UAAU,EACV,KAAK,CAAC,WAAW,EACjB,KAAK,CAAC,YAAY,EAClB,KAAK,CAAC,YAAY,EAClB,cAAc,EACd,KAAK,CAAC,aAAa,EACnB,KAAK,CAAC,cAAc,EACpB,KAAK,CAAC,SAAS,CACf,CAAC;gBACF,YAAY,GAAG,IAAI,CAAC;aACpB;SACD;QACD,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,8BAA8B,EAAE,YAAY,EAAE,CAAC;IACrF,CAAC;CACD,CAAC","sourcesContent":["import { CardIds } from '@firestone-hs/reference-data';\r\nimport { BoardEntity } from '../../../board-entity';\r\nimport { removeAurasFromSelf } from '../../../simulation/add-minion-to-board';\r\nimport { spawnEntities } from '../../../simulation/deathrattle-spawns';\r\nimport { performEntitySpawns } from '../../../simulation/spawns';\r\nimport { SoCInput } from '../../../simulation/start-of-combat/start-of-combat-input';\r\nimport { copyEntity } from '../../../utils';\r\nimport { StartOfCombatCard } from '../../card.interface';\r\n\r\nexport const Zergling: StartOfCombatCard = {\r\n\tcardIds: [CardIds.KerriganQueenOfBlades_ZerglingToken_BG31_HERO_811t2, CardIds.Zergling_BG31_HERO_811t2_G],\r\n\tstartOfCombat: (minion: BoardEntity, input: SoCInput) => {\r\n\t\tlet hasTriggered = false;\r\n\t\tconst loops = minion.cardId === CardIds.Zergling_BG31_HERO_811t2_G ? 2 : 1;\r\n\t\tfor (let i = 0; i < loops; i++) {\r\n\t\t\tif (input.playerBoard.length < 7) {\r\n\t\t\t\tconst copy = copyEntity(minion);\r\n\t\t\t\tremoveAurasFromSelf(copy, input.playerBoard, input.playerEntity, input.gameState);\r\n\t\t\t\tconst newMinions = spawnEntities(\r\n\t\t\t\t\tcopy.cardId,\r\n\t\t\t\t\t1,\r\n\t\t\t\t\tinput.playerBoard,\r\n\t\t\t\t\tinput.playerEntity,\r\n\t\t\t\t\tinput.opponentBoard,\r\n\t\t\t\t\tinput.opponentEntity,\r\n\t\t\t\t\tinput.gameState.allCards,\r\n\t\t\t\t\tinput.gameState.cardsData,\r\n\t\t\t\t\tinput.gameState.sharedState,\r\n\t\t\t\t\tinput.gameState.spectator,\r\n\t\t\t\t\tinput.playerEntity.friendly,\r\n\t\t\t\t\tfalse,\r\n\t\t\t\t\tfalse,\r\n\t\t\t\t\tfalse,\r\n\t\t\t\t\tcopy,\r\n\t\t\t\t);\r\n\t\t\t\tconst indexFromRight = input.playerBoard.length - input.playerBoard.indexOf(minion) - 1;\r\n\t\t\t\tconst spawns = performEntitySpawns(\r\n\t\t\t\t\tnewMinions,\r\n\t\t\t\t\tinput.playerBoard,\r\n\t\t\t\t\tinput.playerEntity,\r\n\t\t\t\t\tinput.playerEntity,\r\n\t\t\t\t\tindexFromRight,\r\n\t\t\t\t\tinput.opponentBoard,\r\n\t\t\t\t\tinput.opponentEntity,\r\n\t\t\t\t\tinput.gameState,\r\n\t\t\t\t);\r\n\t\t\t\thasTriggered = true;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn { hasTriggered: hasTriggered, shouldRecomputeCurrentAttacker: hasTriggered };\r\n\t},\r\n};\r\n"]}
|
|
@@ -196,6 +196,7 @@ const VALID_DEATHRATTLE_ENCHANTMENTS = [
|
|
|
196
196
|
"BG30_MagicItem_917e",
|
|
197
197
|
"BG30_MagicItem_411e",
|
|
198
198
|
"BG30_MagicItem_952e",
|
|
199
|
+
"BG31_HERO_801ptee",
|
|
199
200
|
];
|
|
200
201
|
const validDeathrattleEnchantmentsFromMapping = [];
|
|
201
202
|
const isValidDeathrattleEnchantment = (cardId) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"simulate-bgs-battle.js","sourceRoot":"","sources":["../src/simulate-bgs-battle.ts"],"names":[],"mappings":";;;AACA,iEAAwE;AAExE,2DAAyG;AACzG,mDAA+C;AAC/C,gEAA2D;AAC3D,+CAA4C;AAC5C,yDAAqD;AAGrD,4DAAwD;AACxD,sDAAmD;AACnD,gEAA6D;AAE7D,IAAI,WAAW,GAAG,IAAI,gCAAe,EAAE,CAAC;AAEjC,MAAM,WAAW,GAAG,CAAC,KAAsB,EAAE,EAAE;IACrD,WAAW,GAAG,KAAK,CAAC;AACrB,CAAC,CAAC;AAFW,QAAA,WAAW,eAEtB;AAKF,kBAAe,KAAK,EAAE,KAAK,EAAgB,EAAE;;IAC5C,IAAI,CAAC,CAAA,MAAA,KAAK,CAAC,IAAI,0CAAE,MAAM,CAAA,EAAE;QACxB,OAAO,CAAC,IAAI,CAAC,oBAAoB,EAAE,KAAK,CAAC,CAAC;QAC1C,OAAO;KACP;IAED,MAAM,WAAW,GAAkB,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC1D,MAAM,KAAK,GAAG,WAAW,CAAC;IAC1B,MAAM,KAAK,CAAC,iBAAiB,EAAE,CAAC;IAChC,MAAM,SAAS,GAAG,IAAI,sBAAS,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IAC9C,SAAS,CAAC,YAAY,CACrB,MAAA,MAAA,WAAW,CAAC,SAAS,0CAAE,WAAW,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CAAC;AAC5C,MAAM,6BAA6B,GAAG,CAAC,MAAc,EAAW,EAAE;IACxE,IAAI,8BAA8B,CAAC,QAAQ,CAAC,MAAiB,CAAC,EAAE;QAC/D,OAAO,IAAI,CAAC;KACZ;IACD,IAAI,uCAAuC,CAAC,MAAM,KAAK,CAAC,EAAE;QACzD,KAAK,MAAM,QAAQ,IAAI,MAAM,CAAC,MAAM,CAAC,6BAAY,CAAC,EAAE;YACnD,IAAI,IAAA,gDAA+B,EAAC,QAAQ,CAAC,IAAI,IAAA,+CAA8B,EAAC,QAAQ,CAAC,EAAE;gBAC1F,uCAAuC,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAC;aAClE;SACD;KACD;IACD,OAAO,uCAAuC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;AACjE,CAAC,CAAC;AAZW,QAAA,6BAA6B,iCAYxC","sourcesContent":["/* eslint-disable @typescript-eslint/no-use-before-define */\r\nimport { AllCardsService, CardIds } from '@firestone-hs/reference-data';\r\nimport { BgsBattleInfo } from './bgs-battle-info';\r\nimport { hasDeathrattleEnchantmentEffect, hasDeathrattleSpawnEnchantment } from './cards/card.interface';\r\nimport { CardsData } from './cards/cards-data';\r\nimport { cardMappings } from './cards/impl/_card-mappings';\r\nimport { cloneInput3 } from './input-clone';\r\nimport { buildFinalInput } from './input-sanitation';\r\nimport { SimulationResult } from './simulation-result';\r\nimport { FullGameState } from './simulation/internal-game-state';\r\nimport { SharedState } from './simulation/shared-state';\r\nimport { Simulator } from './simulation/simulator';\r\nimport { Spectator } from './simulation/spectator/spectator';\r\n\r\nlet globalCards = new AllCardsService();\r\n\r\nexport const assignCards = (cards: AllCardsService) => {\r\n\tglobalCards = cards;\r\n};\r\n\r\n// This example demonstrates a NodeJS 8.10 async handler[1], however of course you could use\r\n// the more traditional callback-style handler.\r\n// [1]: https://aws.amazon.com/blogs/compute/node-js-8-10-runtime-now-available-in-aws-lambda/\r\nexport default async (event): Promise<any> => {\r\n\tif (!event.body?.length) {\r\n\t\tconsole.warn('missing event body', event);\r\n\t\treturn;\r\n\t}\r\n\r\n\tconst battleInput: BgsBattleInfo = JSON.parse(event.body);\r\n\tconst cards = globalCards;\r\n\tawait cards.initializeCardsDb();\r\n\tconst cardsData = new CardsData(cards, false);\r\n\tcardsData.inititialize(\r\n\t\tbattleInput.gameState?.validTribes ?? battleInput.options?.validTribes,\r\n\t\tbattleInput.gameState?.anomalies ?? [],\r\n\t);\r\n\tconst battleIterator = simulateBattle(battleInput, cards, cardsData);\r\n\r\n\t// Iterate through all intermediate results to reach the final result\r\n\tlet result = battleIterator.next();\r\n\twhile (!result.done) {\r\n\t\tresult = battleIterator.next();\r\n\t}\r\n\r\n\tconst simulationResult = result.value;\r\n\t// console.debug('simulationResult', simulationResult);\r\n\r\n\tconst response = {\r\n\t\tstatusCode: 200,\r\n\t\tisBase64Encoded: false,\r\n\t\tbody: JSON.stringify(simulationResult),\r\n\t};\r\n\treturn response;\r\n};\r\n\r\nexport const simulateBattle = function* (\r\n\tbattleInput: BgsBattleInfo,\r\n\tcards: AllCardsService,\r\n\tcardsData: CardsData,\r\n): Generator<SimulationResult, SimulationResult, void> {\r\n\tif (!cards?.getCards()?.length) {\r\n\t\tconsole.error('[simulate-bgs-battle] reference cards are empty, cannot simulate battle', cards);\r\n\t\treturn null;\r\n\t}\r\n\t// !battleInput.options?.skipInfoLogs && console.time('full-sim');\r\n\tconst start = Date.now();\r\n\tconst maxAcceptableDuration = battleInput.options?.maxAcceptableDuration || 8000;\r\n\tconst numberOfSimulations = battleInput.options?.numberOfSimulations || 8000;\r\n\tconst intermediateSteps = battleInput.options?.intermediateResults ?? 200;\r\n\tconst includeOutcomeSamples = battleInput.options?.includeOutcomeSamples ?? true;\r\n\tconst simulationResult: SimulationResult = {\r\n\t\twonLethal: 0,\r\n\t\twon: 0,\r\n\t\ttied: 0,\r\n\t\tlost: 0,\r\n\t\tlostLethal: 0,\r\n\t\tdamageWon: 0,\r\n\t\tdamageLost: 0,\r\n\t\twonLethalPercent: undefined,\r\n\t\twonPercent: undefined,\r\n\t\ttiedPercent: undefined,\r\n\t\tlostPercent: undefined,\r\n\t\tlostLethalPercent: undefined,\r\n\t\taverageDamageWon: undefined,\r\n\t\taverageDamageLost: undefined,\r\n\t};\r\n\r\n\tconst spectator = new Spectator(includeOutcomeSamples);\r\n\tconst inputReady = buildFinalInput(battleInput, cards, cardsData);\r\n\t!battleInput.options?.skipInfoLogs && console.time('simulation');\r\n\tconst outcomes = {};\r\n\tfor (let i = 0; i < numberOfSimulations; i++) {\r\n\t\tconst input: BgsBattleInfo = cloneInput3(inputReady);\r\n\t\tconst inputClone: BgsBattleInfo = cloneInput3(inputReady);\r\n\t\tconst gameState: FullGameState = {\r\n\t\t\tallCards: cards,\r\n\t\t\tcardsData: cardsData,\r\n\t\t\tspectator: spectator,\r\n\t\t\tsharedState: new SharedState(),\r\n\t\t\tcurrentTurn: input.gameState.currentTurn,\r\n\t\t\tvalidTribes: input.gameState.validTribes,\r\n\t\t\tanomalies: input.gameState.anomalies,\r\n\t\t\tgameState: {\r\n\t\t\t\tplayer: {\r\n\t\t\t\t\tplayer: input.playerBoard.player,\r\n\t\t\t\t\tboard: input.playerBoard.board,\r\n\t\t\t\t\tteammate: input.playerTeammateBoard,\r\n\t\t\t\t},\r\n\t\t\t\topponent: {\r\n\t\t\t\t\tplayer: input.opponentBoard.player,\r\n\t\t\t\t\tboard: input.opponentBoard.board,\r\n\t\t\t\t\tteammate: input.opponentTeammateBoard,\r\n\t\t\t\t},\r\n\t\t\t\tplayerInitial: {\r\n\t\t\t\t\tplayer: inputClone.playerBoard.player,\r\n\t\t\t\t\tboard: inputClone.playerBoard.board,\r\n\t\t\t\t\tteammate: inputClone.playerTeammateBoard,\r\n\t\t\t\t},\r\n\t\t\t\topponentInitial: {\r\n\t\t\t\t\tplayer: inputClone.opponentBoard.player,\r\n\t\t\t\t\tboard: inputClone.opponentBoard.board,\r\n\t\t\t\t\tteammate: inputClone.opponentTeammateBoard,\r\n\t\t\t\t},\r\n\t\t\t},\r\n\t\t};\r\n\t\tconst simulator = new Simulator(gameState);\r\n\t\tconst battleResult = simulator.simulateSingleBattle(gameState.gameState.player, gameState.gameState.opponent);\r\n\t\tif (Date.now() - start > maxAcceptableDuration) {\r\n\t\t\t// Can happen in case of inifinite boards, or a bug. Don't hog the user's computer in that case\r\n\t\t\tconsole.warn('Stopping simulation after', i, 'iterations and ', Date.now() - start, 'ms');\r\n\t\t\tbreak;\r\n\t\t}\r\n\t\tif (!battleResult) {\r\n\t\t\tcontinue;\r\n\t\t}\r\n\t\tif (battleResult.result === 'won') {\r\n\t\t\tsimulationResult.won++;\r\n\t\t\tsimulationResult.damageWon += battleResult.damageDealt;\r\n\t\t\tif (battleResult.damageDealt >= battleInput.opponentBoard.player.hpLeft) {\r\n\t\t\t\tsimulationResult.wonLethal++;\r\n\t\t\t}\r\n\t\t} else if (battleResult.result === 'lost') {\r\n\t\t\tsimulationResult.lost++;\r\n\t\t\tsimulationResult.damageLost += battleResult.damageDealt;\r\n\t\t\toutcomes[battleResult.damageDealt] = (outcomes[battleResult.damageDealt] ?? 0) + 1;\r\n\t\t\tif (\r\n\t\t\t\tbattleInput.playerBoard.player.hpLeft &&\r\n\t\t\t\tbattleResult.damageDealt >= battleInput.playerBoard.player.hpLeft\r\n\t\t\t) {\r\n\t\t\t\tsimulationResult.lostLethal++;\r\n\t\t\t}\r\n\t\t} else if (battleResult.result === 'tied') {\r\n\t\t\tsimulationResult.tied++;\r\n\t\t}\r\n\t\tspectator.commitBattleResult(battleResult.result);\r\n\r\n\t\t// Yield intermediate result every 200 iterations\r\n\t\tif (!!intermediateSteps && i > 0 && i % intermediateSteps === 0) {\r\n\t\t\tupdateSimulationResult(simulationResult, inputReady);\r\n\t\t\tyield simulationResult;\r\n\t\t}\r\n\t}\r\n\tupdateSimulationResult(simulationResult, inputReady);\r\n\t!battleInput.options?.skipInfoLogs && console.timeEnd('simulation');\r\n\tspectator.prune();\r\n\tsimulationResult.outcomeSamples = spectator.buildOutcomeSamples(battleInput.gameState);\r\n\t// !battleInput.options?.skipInfoLogs && console.timeEnd('full-sim');\r\n\treturn simulationResult;\r\n};\r\n\r\nconst updateSimulationResult = (simulationResult: SimulationResult, input: BgsBattleInfo) => {\r\n\tconst totalMatches = simulationResult.won + simulationResult.tied + simulationResult.lost;\r\n\tsimulationResult.wonPercent = checkRounding(\r\n\t\tMath.round((10 * (100 * simulationResult.won)) / totalMatches) / 10,\r\n\t\tsimulationResult.won,\r\n\t\ttotalMatches,\r\n\t);\r\n\tsimulationResult.wonLethalPercent = checkRounding(\r\n\t\tMath.round((10 * (100 * simulationResult.wonLethal)) / totalMatches) / 10,\r\n\t\tsimulationResult.wonLethal,\r\n\t\ttotalMatches,\r\n\t);\r\n\tsimulationResult.lostPercent = checkRounding(\r\n\t\tMath.round((10 * (100 * simulationResult.lost)) / totalMatches) / 10,\r\n\t\tsimulationResult.lost,\r\n\t\ttotalMatches,\r\n\t);\r\n\tsimulationResult.lostLethalPercent = checkRounding(\r\n\t\tMath.round((10 * (100 * simulationResult.lostLethal)) / totalMatches) / 10,\r\n\t\tsimulationResult.lostLethal,\r\n\t\ttotalMatches,\r\n\t);\r\n\tsimulationResult.tiedPercent = checkRounding(\r\n\t\tMath.max(0, 100 - simulationResult.lostPercent - simulationResult.wonPercent),\r\n\t\tsimulationResult.tied,\r\n\t\ttotalMatches,\r\n\t);\r\n\r\n\t// simulationResult.wonLethalPercent = Math.round((10 * (100 * simulationResult.wonLethal)) / totalMatches) / 10;\r\n\t// simulationResult.lostLethalPercent = Math.round((10 * (100 * simulationResult.lostLethal)) / totalMatches) / 10;\r\n\tsimulationResult.averageDamageWon = simulationResult.won ? simulationResult.damageWon / simulationResult.won : 0;\r\n\tsimulationResult.averageDamageLost = simulationResult.lost\r\n\t\t? simulationResult.damageLost / simulationResult.lost\r\n\t\t: 0;\r\n\tif (\r\n\t\tsimulationResult.averageDamageWon > 0 &&\r\n\t\tsimulationResult.averageDamageWon < input.playerBoard.player.tavernTier\r\n\t) {\r\n\t\tconsole.warn('average damage won issue');\r\n\t}\r\n\tif (\r\n\t\tsimulationResult.averageDamageLost > 0 &&\r\n\t\tsimulationResult.averageDamageLost < input.opponentBoard.player.tavernTier\r\n\t) {\r\n\t\tconsole.warn('average damage lost issue');\r\n\t}\r\n};\r\n\r\nconst checkRounding = (roundedValue: number, initialValue: number, totalValue: number): number => {\r\n\tif (roundedValue === 0 && initialValue !== 0) {\r\n\t\treturn 0.01;\r\n\t}\r\n\tif (roundedValue === 100 && initialValue !== totalValue) {\r\n\t\treturn 99.9;\r\n\t}\r\n\treturn roundedValue;\r\n};\r\n\r\n// Used when triggering random deathrattles\r\nconst VALID_DEATHRATTLE_ENCHANTMENTS = [\r\n\tCardIds.ReplicatingMenace_ReplicatingMenaceEnchantment_BG_BOT_312e,\r\n\tCardIds.ReplicatingMenace_ReplicatingMenaceEnchantment_TB_BaconUps_032e,\r\n\tCardIds.LivingSpores_LivingSporesEnchantment,\r\n\tCardIds.Leapfrogger_LeapfrogginEnchantment_BG21_000e,\r\n\tCardIds.Leapfrogger_LeapfrogginEnchantment_BG21_000_Ge,\r\n\tCardIds.Sneed_SneedsReplicator,\r\n\tCardIds.SneedsReplicator_ReplicateEnchantment,\r\n\tCardIds.EarthRecollectionEnchantment, // Spirit Raptor\r\n\tCardIds.FireRecollectionEnchantment,\r\n\tCardIds.LightningRecollectionEnchantment,\r\n\tCardIds.WaterRecollectionEnchantment,\r\n\tCardIds.EarthInvocation_ElementEarthEnchantment, // Summon a 1/1\r\n\tCardIds.LightningInvocation, // Deal 1 damage to 5 enemy minions\r\n\tCardIds.SurfNSurf_CrabRidingEnchantment_BG27_004e,\r\n\tCardIds.SurfNSurf_CrabRidingEnchantment_BG27_004_Ge,\r\n\tCardIds.RecurringNightmare_NightmareInsideEnchantment_BG26_055e,\r\n\tCardIds.RecurringNightmare_NightmareInsideEnchantment_BG26_055_Ge,\r\n\tCardIds.BoonOfBeetles_BeetleSwarmEnchantment_BG28_603e,\r\n\tCardIds.RustyTrident_TridentsTreasureEnchantment_BG30_MagicItem_917e,\r\n\tCardIds.HoggyBank_GemInTheBankEnchantment_BG30_MagicItem_411e,\r\n\tCardIds.JarredFrostling_FrostyGlobeEnchantment_BG30_MagicItem_952e,\r\n];\r\nconst validDeathrattleEnchantmentsFromMapping = [];\r\nexport const isValidDeathrattleEnchantment = (cardId: string): boolean => {\r\n\tif (VALID_DEATHRATTLE_ENCHANTMENTS.includes(cardId as CardIds)) {\r\n\t\treturn true;\r\n\t}\r\n\tif (validDeathrattleEnchantmentsFromMapping.length === 0) {\r\n\t\tfor (const cardImpl of Object.values(cardMappings)) {\r\n\t\t\tif (hasDeathrattleEnchantmentEffect(cardImpl) || hasDeathrattleSpawnEnchantment(cardImpl)) {\r\n\t\t\t\tvalidDeathrattleEnchantmentsFromMapping.push(...cardImpl.cardIds);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn validDeathrattleEnchantmentsFromMapping.includes(cardId);\r\n};\r\n\r\n// const cleanEnchantmentsForEntity = (\r\n// \tenchantments: { cardId: string; originEntityId?: number; timing: number }[],\r\n// \tentityIds: readonly number[],\r\n// ): { cardId: string; originEntityId?: number; timing: number }[] => {\r\n// \treturn enchantments.filter(\r\n// \t\t(enchant) =>\r\n// \t\t\tentityIds.indexOf(enchant.originEntityId) !== -1 ||\r\n// \t\t\tvalidEnchantments.indexOf(enchant.cardId as CardIds) !== -1,\r\n// \t);\r\n// };\r\n"]}
|
|
1
|
+
{"version":3,"file":"simulate-bgs-battle.js","sourceRoot":"","sources":["../src/simulate-bgs-battle.ts"],"names":[],"mappings":";;;AACA,iEAAwE;AAExE,2DAAyG;AACzG,mDAA+C;AAC/C,gEAA2D;AAC3D,+CAA4C;AAC5C,yDAAqD;AAGrD,4DAAwD;AACxD,sDAAmD;AACnD,gEAA6D;AAE7D,IAAI,WAAW,GAAG,IAAI,gCAAe,EAAE,CAAC;AAEjC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AllCardsService, CardIds } from '@firestone-hs/reference-data';\r\nimport { BgsBattleInfo } from './bgs-battle-info';\r\nimport { hasDeathrattleEnchantmentEffect, hasDeathrattleSpawnEnchantment } from './cards/card.interface';\r\nimport { CardsData } from './cards/cards-data';\r\nimport { cardMappings } from './cards/impl/_card-mappings';\r\nimport { cloneInput3 } from './input-clone';\r\nimport { buildFinalInput } from './input-sanitation';\r\nimport { SimulationResult } from './simulation-result';\r\nimport { FullGameState } from './simulation/internal-game-state';\r\nimport { SharedState } from './simulation/shared-state';\r\nimport { Simulator } from './simulation/simulator';\r\nimport { Spectator } from './simulation/spectator/spectator';\r\n\r\nlet globalCards = new AllCardsService();\r\n\r\nexport const assignCards = (cards: AllCardsService) => {\r\n\tglobalCards = cards;\r\n};\r\n\r\n// This example demonstrates a NodeJS 8.10 async handler[1], however of course you could use\r\n// the more traditional callback-style handler.\r\n// [1]: https://aws.amazon.com/blogs/compute/node-js-8-10-runtime-now-available-in-aws-lambda/\r\nexport default async (event): Promise<any> => {\r\n\tif (!event.body?.length) {\r\n\t\tconsole.warn('missing event body', event);\r\n\t\treturn;\r\n\t}\r\n\r\n\tconst battleInput: BgsBattleInfo = JSON.parse(event.body);\r\n\tconst cards = globalCards;\r\n\tawait cards.initializeCardsDb();\r\n\tconst cardsData = new CardsData(cards, false);\r\n\tcardsData.inititialize(\r\n\t\tbattleInput.gameState?.validTribes ?? battleInput.options?.validTribes,\r\n\t\tbattleInput.gameState?.anomalies ?? [],\r\n\t);\r\n\tconst battleIterator = simulateBattle(battleInput, cards, cardsData);\r\n\r\n\t// Iterate through all intermediate results to reach the final result\r\n\tlet result = battleIterator.next();\r\n\twhile (!result.done) {\r\n\t\tresult = battleIterator.next();\r\n\t}\r\n\r\n\tconst simulationResult = result.value;\r\n\t// console.debug('simulationResult', simulationResult);\r\n\r\n\tconst response = {\r\n\t\tstatusCode: 200,\r\n\t\tisBase64Encoded: false,\r\n\t\tbody: JSON.stringify(simulationResult),\r\n\t};\r\n\treturn response;\r\n};\r\n\r\nexport const simulateBattle = function* (\r\n\tbattleInput: BgsBattleInfo,\r\n\tcards: AllCardsService,\r\n\tcardsData: CardsData,\r\n): Generator<SimulationResult, SimulationResult, void> {\r\n\tif (!cards?.getCards()?.length) {\r\n\t\tconsole.error('[simulate-bgs-battle] reference cards are empty, cannot simulate battle', cards);\r\n\t\treturn null;\r\n\t}\r\n\t// !battleInput.options?.skipInfoLogs && console.time('full-sim');\r\n\tconst start = Date.now();\r\n\tconst maxAcceptableDuration = battleInput.options?.maxAcceptableDuration || 8000;\r\n\tconst numberOfSimulations = battleInput.options?.numberOfSimulations || 8000;\r\n\tconst intermediateSteps = battleInput.options?.intermediateResults ?? 200;\r\n\tconst includeOutcomeSamples = battleInput.options?.includeOutcomeSamples ?? true;\r\n\tconst simulationResult: SimulationResult = {\r\n\t\twonLethal: 0,\r\n\t\twon: 0,\r\n\t\ttied: 0,\r\n\t\tlost: 0,\r\n\t\tlostLethal: 0,\r\n\t\tdamageWon: 0,\r\n\t\tdamageLost: 0,\r\n\t\twonLethalPercent: undefined,\r\n\t\twonPercent: undefined,\r\n\t\ttiedPercent: undefined,\r\n\t\tlostPercent: undefined,\r\n\t\tlostLethalPercent: undefined,\r\n\t\taverageDamageWon: undefined,\r\n\t\taverageDamageLost: undefined,\r\n\t};\r\n\r\n\tconst spectator = new Spectator(includeOutcomeSamples);\r\n\tconst inputReady = buildFinalInput(battleInput, cards, cardsData);\r\n\t!battleInput.options?.skipInfoLogs && console.time('simulation');\r\n\tconst outcomes = {};\r\n\tfor (let i = 0; i < numberOfSimulations; i++) {\r\n\t\tconst input: BgsBattleInfo = cloneInput3(inputReady);\r\n\t\tconst inputClone: BgsBattleInfo = cloneInput3(inputReady);\r\n\t\tconst gameState: FullGameState = {\r\n\t\t\tallCards: cards,\r\n\t\t\tcardsData: cardsData,\r\n\t\t\tspectator: spectator,\r\n\t\t\tsharedState: new SharedState(),\r\n\t\t\tcurrentTurn: input.gameState.currentTurn,\r\n\t\t\tvalidTribes: input.gameState.validTribes,\r\n\t\t\tanomalies: input.gameState.anomalies,\r\n\t\t\tgameState: {\r\n\t\t\t\tplayer: {\r\n\t\t\t\t\tplayer: input.playerBoard.player,\r\n\t\t\t\t\tboard: input.playerBoard.board,\r\n\t\t\t\t\tteammate: input.playerTeammateBoard,\r\n\t\t\t\t},\r\n\t\t\t\topponent: {\r\n\t\t\t\t\tplayer: input.opponentBoard.player,\r\n\t\t\t\t\tboard: input.opponentBoard.board,\r\n\t\t\t\t\tteammate: input.opponentTeammateBoard,\r\n\t\t\t\t},\r\n\t\t\t\tplayerInitial: {\r\n\t\t\t\t\tplayer: inputClone.playerBoard.player,\r\n\t\t\t\t\tboard: inputClone.playerBoard.board,\r\n\t\t\t\t\tteammate: inputClone.playerTeammateBoard,\r\n\t\t\t\t},\r\n\t\t\t\topponentInitial: {\r\n\t\t\t\t\tplayer: inputClone.opponentBoard.player,\r\n\t\t\t\t\tboard: inputClone.opponentBoard.board,\r\n\t\t\t\t\tteammate: inputClone.opponentTeammateBoard,\r\n\t\t\t\t},\r\n\t\t\t},\r\n\t\t};\r\n\t\tconst simulator = new Simulator(gameState);\r\n\t\tconst battleResult = simulator.simulateSingleBattle(gameState.gameState.player, gameState.gameState.opponent);\r\n\t\tif (Date.now() - start > maxAcceptableDuration) {\r\n\t\t\t// Can happen in case of inifinite boards, or a bug. Don't hog the user's computer in that case\r\n\t\t\tconsole.warn('Stopping simulation after', i, 'iterations and ', Date.now() - start, 'ms');\r\n\t\t\tbreak;\r\n\t\t}\r\n\t\tif (!battleResult) {\r\n\t\t\tcontinue;\r\n\t\t}\r\n\t\tif (battleResult.result === 'won') {\r\n\t\t\tsimulationResult.won++;\r\n\t\t\tsimulationResult.damageWon += battleResult.damageDealt;\r\n\t\t\tif (battleResult.damageDealt >= battleInput.opponentBoard.player.hpLeft) {\r\n\t\t\t\tsimulationResult.wonLethal++;\r\n\t\t\t}\r\n\t\t} else if (battleResult.result === 'lost') {\r\n\t\t\tsimulationResult.lost++;\r\n\t\t\tsimulationResult.damageLost += battleResult.damageDealt;\r\n\t\t\toutcomes[battleResult.damageDealt] = (outcomes[battleResult.damageDealt] ?? 0) + 1;\r\n\t\t\tif (\r\n\t\t\t\tbattleInput.playerBoard.player.hpLeft &&\r\n\t\t\t\tbattleResult.damageDealt >= battleInput.playerBoard.player.hpLeft\r\n\t\t\t) {\r\n\t\t\t\tsimulationResult.lostLethal++;\r\n\t\t\t}\r\n\t\t} else if (battleResult.result === 'tied') {\r\n\t\t\tsimulationResult.tied++;\r\n\t\t}\r\n\t\tspectator.commitBattleResult(battleResult.result);\r\n\r\n\t\t// Yield intermediate result every 200 iterations\r\n\t\tif (!!intermediateSteps && i > 0 && i % intermediateSteps === 0) {\r\n\t\t\tupdateSimulationResult(simulationResult, inputReady);\r\n\t\t\tyield simulationResult;\r\n\t\t}\r\n\t}\r\n\tupdateSimulationResult(simulationResult, inputReady);\r\n\t!battleInput.options?.skipInfoLogs && console.timeEnd('simulation');\r\n\tspectator.prune();\r\n\tsimulationResult.outcomeSamples = spectator.buildOutcomeSamples(battleInput.gameState);\r\n\t// !battleInput.options?.skipInfoLogs && console.timeEnd('full-sim');\r\n\treturn simulationResult;\r\n};\r\n\r\nconst updateSimulationResult = (simulationResult: SimulationResult, input: BgsBattleInfo) => {\r\n\tconst totalMatches = simulationResult.won + simulationResult.tied + simulationResult.lost;\r\n\tsimulationResult.wonPercent = checkRounding(\r\n\t\tMath.round((10 * (100 * simulationResult.won)) / totalMatches) / 10,\r\n\t\tsimulationResult.won,\r\n\t\ttotalMatches,\r\n\t);\r\n\tsimulationResult.wonLethalPercent = checkRounding(\r\n\t\tMath.round((10 * (100 * simulationResult.wonLethal)) / totalMatches) / 10,\r\n\t\tsimulationResult.wonLethal,\r\n\t\ttotalMatches,\r\n\t);\r\n\tsimulationResult.lostPercent = checkRounding(\r\n\t\tMath.round((10 * (100 * simulationResult.lost)) / totalMatches) / 10,\r\n\t\tsimulationResult.lost,\r\n\t\ttotalMatches,\r\n\t);\r\n\tsimulationResult.lostLethalPercent = checkRounding(\r\n\t\tMath.round((10 * (100 * simulationResult.lostLethal)) / totalMatches) / 10,\r\n\t\tsimulationResult.lostLethal,\r\n\t\ttotalMatches,\r\n\t);\r\n\tsimulationResult.tiedPercent = checkRounding(\r\n\t\tMath.max(0, 100 - simulationResult.lostPercent - simulationResult.wonPercent),\r\n\t\tsimulationResult.tied,\r\n\t\ttotalMatches,\r\n\t);\r\n\r\n\t// simulationResult.wonLethalPercent = Math.round((10 * (100 * simulationResult.wonLethal)) / totalMatches) / 10;\r\n\t// simulationResult.lostLethalPercent = Math.round((10 * (100 * simulationResult.lostLethal)) / totalMatches) / 10;\r\n\tsimulationResult.averageDamageWon = simulationResult.won ? simulationResult.damageWon / simulationResult.won : 0;\r\n\tsimulationResult.averageDamageLost = simulationResult.lost\r\n\t\t? simulationResult.damageLost / simulationResult.lost\r\n\t\t: 0;\r\n\tif (\r\n\t\tsimulationResult.averageDamageWon > 0 &&\r\n\t\tsimulationResult.averageDamageWon < input.playerBoard.player.tavernTier\r\n\t) {\r\n\t\tconsole.warn('average damage won issue');\r\n\t}\r\n\tif (\r\n\t\tsimulationResult.averageDamageLost > 0 &&\r\n\t\tsimulationResult.averageDamageLost < input.opponentBoard.player.tavernTier\r\n\t) {\r\n\t\tconsole.warn('average damage lost issue');\r\n\t}\r\n};\r\n\r\nconst checkRounding = (roundedValue: number, initialValue: number, totalValue: number): number => {\r\n\tif (roundedValue === 0 && initialValue !== 0) {\r\n\t\treturn 0.01;\r\n\t}\r\n\tif (roundedValue === 100 && initialValue !== totalValue) {\r\n\t\treturn 99.9;\r\n\t}\r\n\treturn roundedValue;\r\n};\r\n\r\n// Used when triggering random deathrattles\r\nconst VALID_DEATHRATTLE_ENCHANTMENTS = [\r\n\tCardIds.ReplicatingMenace_ReplicatingMenaceEnchantment_BG_BOT_312e,\r\n\tCardIds.ReplicatingMenace_ReplicatingMenaceEnchantment_TB_BaconUps_032e,\r\n\tCardIds.LivingSpores_LivingSporesEnchantment,\r\n\tCardIds.Leapfrogger_LeapfrogginEnchantment_BG21_000e,\r\n\tCardIds.Leapfrogger_LeapfrogginEnchantment_BG21_000_Ge,\r\n\tCardIds.Sneed_SneedsReplicator,\r\n\tCardIds.SneedsReplicator_ReplicateEnchantment,\r\n\tCardIds.EarthRecollectionEnchantment, // Spirit Raptor\r\n\tCardIds.FireRecollectionEnchantment,\r\n\tCardIds.LightningRecollectionEnchantment,\r\n\tCardIds.WaterRecollectionEnchantment,\r\n\tCardIds.EarthInvocation_ElementEarthEnchantment, // Summon a 1/1\r\n\tCardIds.LightningInvocation, // Deal 1 damage to 5 enemy minions\r\n\tCardIds.SurfNSurf_CrabRidingEnchantment_BG27_004e,\r\n\tCardIds.SurfNSurf_CrabRidingEnchantment_BG27_004_Ge,\r\n\tCardIds.RecurringNightmare_NightmareInsideEnchantment_BG26_055e,\r\n\tCardIds.RecurringNightmare_NightmareInsideEnchantment_BG26_055_Ge,\r\n\tCardIds.BoonOfBeetles_BeetleSwarmEnchantment_BG28_603e,\r\n\tCardIds.RustyTrident_TridentsTreasureEnchantment_BG30_MagicItem_917e,\r\n\tCardIds.HoggyBank_GemInTheBankEnchantment_BG30_MagicItem_411e,\r\n\tCardIds.JarredFrostling_FrostyGlobeEnchantment_BG30_MagicItem_952e,\r\n\tCardIds.CaduceusReactor_CaduceusReactorEnchantment_BG31_HERO_801ptee,\r\n];\r\nconst validDeathrattleEnchantmentsFromMapping = [];\r\nexport const isValidDeathrattleEnchantment = (cardId: string): boolean => {\r\n\tif (VALID_DEATHRATTLE_ENCHANTMENTS.includes(cardId as CardIds)) {\r\n\t\treturn true;\r\n\t}\r\n\tif (validDeathrattleEnchantmentsFromMapping.length === 0) {\r\n\t\tfor (const cardImpl of Object.values(cardMappings)) {\r\n\t\t\tif (hasDeathrattleEnchantmentEffect(cardImpl) || hasDeathrattleSpawnEnchantment(cardImpl)) {\r\n\t\t\t\tvalidDeathrattleEnchantmentsFromMapping.push(...cardImpl.cardIds);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn validDeathrattleEnchantmentsFromMapping.includes(cardId);\r\n};\r\n\r\n// const cleanEnchantmentsForEntity = (\r\n// \tenchantments: { cardId: string; originEntityId?: number; timing: number }[],\r\n// \tentityIds: readonly number[],\r\n// ): { cardId: string; originEntityId?: number; timing: number }[] => {\r\n// \treturn enchantments.filter(\r\n// \t\t(enchant) =>\r\n// \t\t\tentityIds.indexOf(enchant.originEntityId) !== -1 ||\r\n// \t\t\tvalidEnchantments.indexOf(enchant.cardId as CardIds) !== -1,\r\n// \t);\r\n// };\r\n"]}
|
|
@@ -29,7 +29,7 @@ const simulateAttack = (attackingBoard, attackingBoardHero, defendingBoard, defe
|
|
|
29
29
|
}
|
|
30
30
|
const attackingEntity = getAttackingEntity(attackingBoard, gameState.allCards);
|
|
31
31
|
if (attackingEntity) {
|
|
32
|
-
|
|
32
|
+
gameState.sharedState.currentAttackerEntityId = attackingEntity.entityId;
|
|
33
33
|
const attackingEntityIndex = attackingBoard.indexOf(attackingEntity);
|
|
34
34
|
const attackingEntitiesToTheLeft = attackingBoard.slice(0, attackingEntityIndex);
|
|
35
35
|
const isAttackingImmediately = attackingEntity.attackImmediately;
|
|
@@ -51,7 +51,7 @@ const simulateAttack = (attackingBoard, attackingBoardHero, defendingBoard, defe
|
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
|
-
|
|
54
|
+
gameState.sharedState.currentAttackerEntityId = null;
|
|
55
55
|
attackingEntity.hasAttacked = 1;
|
|
56
56
|
}
|
|
57
57
|
};
|
|
@@ -281,7 +281,6 @@ const dealDamageToMinion = (target, board, hero, damageSource, damage, otherBoar
|
|
|
281
281
|
...(damageSource || {}),
|
|
282
282
|
entityId: -1,
|
|
283
283
|
attack: damage,
|
|
284
|
-
attacking: true,
|
|
285
284
|
};
|
|
286
285
|
const actualDamageDone = (0, exports.bumpEntities)(target, fakeAttacker, board, hero, otherBoard, otherHero, gameState);
|
|
287
286
|
if (fakeAttacker.attack > 0 && target.divineShield) {
|
|
@@ -361,7 +360,6 @@ const bumpEntities = (entity, bumpInto, entityBoard, entityBoardHero, otherBoard
|
|
|
361
360
|
const newSource = {
|
|
362
361
|
...entity,
|
|
363
362
|
attack: bumpInto.attack,
|
|
364
|
-
attacking: true,
|
|
365
363
|
};
|
|
366
364
|
const defenderHadDivineShield = newTarget.divineShield;
|
|
367
365
|
const damageDone = (0, exports.bumpEntities)(newTarget, newSource, otherBoard, otherHero, entityBoard, entityBoardHero, gameState, false);
|