@@ -105,6 +105,13 @@ private int ZonePosition(BattlegroundsTeammateBoardStateEntity e) =>
105105 private int [ ] SortedDbfIds ( IEnumerable < BattlegroundsTeammateBoardStateEntity > entities ) =>
106106 entities . OrderBy ( ZonePosition ) . Select ( DbfId ) . ToArray ( ) ;
107107
108+ private int [ ] SortedDbfIds ( IEnumerable < BoardCard > boardCards ) =>
109+ boardCards
110+ . Where ( c => c ? . CardId != null )
111+ . Select ( c => Database . GetCardFromId ( c . CardId ) ? . DbfId ?? 0 )
112+ . Where ( dbfId => dbfId != 0 )
113+ . ToArray ( ) ;
114+
108115 private int HeroId ( Entity playerEntity ) => playerEntity . GetTag ( GameTag . HERO_ENTITY ) ;
109116
110117 private int WeaponId ( Entity playerEntity ) => playerEntity . GetTag ( GameTag . WEAPON ) ;
@@ -263,6 +270,13 @@ private int HeroDbfId(Entity? entity)
263270 var anomalyId = new [ ] { GameTag . ANOMALY1 , GameTag . ANOMALY2 } . Select ( x => Core . Game . GameEntity ? . GetTag ( x ) ) . FirstOrDefault ( x => x is > 0 ) ;
264271 var anomaly = anomalyId . HasValue && Core . Game . Entities . TryGetValue ( anomalyId . Value , out var anomalyEntity ) ? anomalyEntity ? . Card . DbfId : null ;
265272
273+ // Check if the special shop (timewarped tavern) is currently active
274+ var specialShopState = Watchers . SpecialShopChoicesStateWatcher . CurrentState ;
275+ var specialShopActive = specialShopState ? . IsActive == true && specialShopState . BoardCards . Count > 0 ;
276+ var opponentBoard = specialShopActive
277+ ? SortedDbfIds ( specialShopState ! . BoardCards )
278+ : SortedDbfIds ( opponent . Board . Where ( x => x . TakesBoardSlot ) ) ;
279+
266280 return new BoardState
267281 {
268282 Player = new BoardStatePlayer
@@ -292,7 +306,7 @@ private int HeroDbfId(Entity? entity)
292306 } ,
293307 Opponent = new BoardStatePlayer
294308 {
295- Board = SortedDbfIds ( opponent . Board . Where ( x => x . TakesBoardSlot ) ) ,
309+ Board = opponentBoard ,
296310 Deck = new BoardStateDeck
297311 {
298312 Size = opponent . DeckCount
@@ -325,6 +339,13 @@ private Tuple<BoardStatePlayer, BoardStatePlayer> GetBattlegroundsSoloPlayerBoar
325339 int ? opponentWeaponEntityId = opponentEntity != null ? WeaponId ( opponentEntity ) : null ;
326340 int opponentWeapon = opponentWeaponEntityId . HasValue ? DbfId ( Find ( opponent , opponentWeaponEntityId . Value ) ) : 0 ;
327341
342+ // Check if the special shop (timewarped tavern) is currently active
343+ var specialShopState = Watchers . SpecialShopChoicesStateWatcher . CurrentState ;
344+ var specialShopActive = specialShopState ? . IsActive == true && specialShopState . BoardCards . Count > 0 ;
345+ var opponentBoard = specialShopActive
346+ ? SortedDbfIds ( specialShopState ! . BoardCards )
347+ : SortedDbfIds ( opponent . Board . Where ( x => x . TakesBoardSlot ) ) ;
348+
328349 return new Tuple < BoardStatePlayer , BoardStatePlayer > (
329350 new BoardStatePlayer
330351 {
@@ -346,7 +367,7 @@ private Tuple<BoardStatePlayer, BoardStatePlayer> GetBattlegroundsSoloPlayerBoar
346367 Fatigue = playerEntity ? . GetTag ( GameTag . FATIGUE ) ?? 0
347368 } , new BoardStatePlayer
348369 {
349- Board = SortedDbfIds ( opponent . Board . Where ( x => x . TakesBoardSlot ) ) ,
370+ Board = opponentBoard ,
350371 Hero = HeroDbfId ( opponentEntity != null ? Find ( opponent , HeroId ( opponentEntity ) ) : null ) ,
351372 HeroPower = BgsQuestReward ( opponent , true ) ?? BgsTrinket ( opponent , TrinketHeroPowerSlot ) ?? DbfId ( FindHeroPower ( opponent ) ) ,
352373 Weapon = opponentWeapon != 0 ? opponentWeapon :
0 commit comments