@@ -234,32 +234,35 @@ private VectorMask FilterJokers(ref MotelyVectorSearchContext ctx)
234234 if ( clauses . Count == 1 && clauses [ 0 ] . ItemTypeEnum == MotelyFilterItemType . SoulJoker &&
235235 clauses [ 0 ] . JokerEnum == MotelyJoker . Perkeo )
236236 {
237+ // Capture clause to avoid closure issues
238+ var perkeoClause = clauses [ 0 ] ;
239+ var effectiveAntes = perkeoClause . EffectiveAntes ?? new [ ] { 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 } ;
237240 return ctx . SearchIndividualSeeds ( ( ref MotelySingleSearchContext singleCtx ) =>
238241 {
239242 // Fast path for Perkeo check
240- foreach ( var ante in clauses [ 0 ] . EffectiveAntes )
243+ foreach ( var ante in effectiveAntes )
241244 {
242- var packStream = singleCtx . CreateBoosterPackStream ( ante , ante != 1 , false ) ;
245+ var packStream = singleCtx . CreateBoosterPackStream ( ante , ante != 1 , isCached : true ) ;
243246 for ( int i = 0 ; i < 4 ; i ++ ) // Check first 4 packs
244247 {
245248 var pack = singleCtx . GetNextBoosterPack ( ref packStream ) ;
246249
247250 if ( pack . GetPackType ( ) == MotelyBoosterPackType . Arcana )
248251 {
249- var tarotStream = singleCtx . CreateArcanaPackTarotStream ( ante , true ) ;
252+ var tarotStream = singleCtx . CreateArcanaPackTarotStream ( ante , soulOnly : true , isCached : true ) ;
250253 if ( singleCtx . GetNextArcanaPackHasTheSoul ( ref tarotStream , pack . GetPackSize ( ) ) )
251254 {
252- var soulStream = singleCtx . CreateSoulJokerStream ( ante ) ;
255+ var soulStream = singleCtx . CreateSoulJokerStream ( ante , isCached : true ) ;
253256 if ( singleCtx . GetNextJoker ( ref soulStream ) . Type == MotelyItemType . Perkeo )
254257 return true ;
255258 }
256259 }
257260 else if ( pack . GetPackType ( ) == MotelyBoosterPackType . Spectral )
258261 {
259- var spectralStream = singleCtx . CreateSpectralPackSpectralStream ( ante , true ) ;
262+ var spectralStream = singleCtx . CreateSpectralPackSpectralStream ( ante , soulOnly : true , isCached : true ) ;
260263 if ( singleCtx . GetNextSpectralPackHasTheSoul ( ref spectralStream , pack . GetPackSize ( ) ) )
261264 {
262- var soulStream = singleCtx . CreateSoulJokerStream ( ante ) ;
265+ var soulStream = singleCtx . CreateSoulJokerStream ( ante , isCached : true ) ;
263266 if ( singleCtx . GetNextJoker ( ref soulStream ) . Type == MotelyItemType . Perkeo )
264267 return true ;
265268 }
0 commit comments