Files

2 lines
1.1 KiB
JavaScript

(function(){"use strict";let p=!1,c={};const f=new Map,P=t=>.006+.06*Math.max(0,t-73),d=()=>{for(let t=1;t<=90;t++)f.set(t,P(t))},m=new Map,g=t=>.006+.06*Math.max(0,t-63),u=()=>{for(let t=1;t<=80;t++)m.set(t,g(t))},D=(()=>{let t=Date.now();return()=>{Date.now()-t>(p?500:10)&&(postMessage({type:"data",data:c}),c={},t=Date.now(),p=!0)}})(),y=({charter_count:t,weapon_count:i,isCharacterGuaranteed:s,isWeaponGuaranteed:n,isDiscount:l,consecutiveOffRate:a,cushioned_count:e,pinkBall_count:r})=>{let o=0,M=0;const h=()=>{o++,e=0,s=!1};for(l&&(r=Math.floor(r/.9));r>0;)r--,e++,o<t||M>=i?Math.random()<f.get(e)&&(e=0,s?h():a===3?(h(),a-=2):Math.random()<.5?(h(),a--):(s=!0,a++)):Math.random()<m.get(e)&&(n||Math.random()<.375?(M++,n=!1):n=!0);const w=(o<<8)+M;c[w]=(c[w]||0)+1,D()};addEventListener("message",t=>{const{charter_count:i,weapon_count:s,isCharacterGuaranteed:n,isWeaponGuaranteed:l,isDiscount:a,consecutiveOffRate:e,cushioned_count:r,pinkBall_count:o}=t.data;for(d(),u(),postMessage({type:"init"});;)y({charter_count:i,weapon_count:s,isCharacterGuaranteed:n,isWeaponGuaranteed:l,isDiscount:a,consecutiveOffRate:e,cushioned_count:r,pinkBall_count:o})})})();