@@ -477,20 +477,41 @@ function calcSimsExact<T>(sims: Sim[], pulls: number, banner: Banner, prune = 1e
477477 const addOrMerge = ( sim : Sim ) => {
478478 if ( sim . rate <= 0 ) return
479479
480- const v = sim . pity + ( banner . maxPity + 1 ) * ( ( sim . const + 1 ) + ( ( banner . maxConst + 2 ) * ( + sim . guaranteed + ( 2 * sim . guaranteedPity ) ) ) )
481- const other = newSims [ v ]
480+ let key = sim . pity
481+ let keySize = banner . maxPity + 1
482482
483- if ( other ) {
484- // if (other.const != sim.const) console.error("const", v, sim, other)
485- // if (other.guaranteed != sim.guaranteed) console.error("guaranteed", v, sim, other)
486- // if (other.guaranteedPity != sim.guaranteedPity) console.error("guaranteedPity", v, sim, other)
487- // if (other.pity != sim.pity) console.error("pity", v, sim, other)
483+ key += ( sim . const + 1 ) * keySize
484+ keySize *= banner . maxConst + 2
485+
486+ key += ( + sim . guaranteed + 1 ) * keySize
487+ keySize *= 2
488+
489+ if ( banner . guaranteedPity ) {
490+ key += ( sim . guaranteedPity + 1 ) * keySize
491+ keySize *= banner . guaranteedPity + 1
492+ }
488493
494+ if ( Array . isArray ( banner . banner ) ) {
495+ key += ( sim . lostPity + 1 ) * keySize
496+ keySize *= banner . banner . length + 1
497+ }
498+
499+ const other = newSims [ key ]
500+
501+ if ( other ) {
502+ // if (other.const != sim.const) console.error("const", key, sim, other)
503+ // else if (other.guaranteed != sim.guaranteed) console.error("guaranteed", key, sim, other)
504+ // else if (other.guaranteedPity != sim.guaranteedPity) console.error("guaranteedPity", key, sim, other)
505+ // else if (other.pity != sim.pity) console.error("pity", key, sim, other)
506+ // else if (other.lostPity != sim.lostPity) console.error("lostPity", key, sim, other)
507+ // else {
489508 other . rate += sim . rate
490509 return
510+ // }
511+ // throw new Error("Unexpected sim")
491512 }
492513
493- newSims [ v ] = sim
514+ newSims [ key ] = sim
494515 }
495516
496517 for ( const sim of sims ) {
0 commit comments