Guest User

Untitled

a guest
Apr 11th, 2025
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function lightconeWarp(pity){
  2.     if (pity >= 80) return true;
  3.     if (pity >= 66){
  4.         const odds = 0.8 + (7* (pity-65))
  5.         return (Math.random() < (odds / 100))
  6.     }
  7.     return (Math.random() < 0.008);
  8. }
  9.  
  10. function characterWarp(pity){
  11.     if (pity >= 90) return true;
  12.     if (pity >= 74){
  13.         const odds = 0.6 + (6* (pity-73))
  14.         return (Math.random() < (odds / 100))
  15.     }
  16.     return (Math.random() < 0.006);
  17. }
  18.  
  19. function rollFiveStar(rateUp){
  20.     if (Math.random() < rateUp) return true;
  21.     const pool = [true, false, false, false, false, false, false, false];
  22.     return pool[Math.floor(Math.random() * pool.length)]
  23. }
  24.  
  25. function e0s1Trial(){
  26.     let gotE0 = false;
  27.     let gotS1 = false;
  28.     let charPity = 0;
  29.     let conePity = 0;
  30.     let charGuarantee = false;
  31.     let coneGuarantee = false;
  32.     let totalCharWarps = 0;
  33.     let totalConeWarps = 0;
  34.     while(!gotE0){
  35.         let got5Star = false;
  36.         while (!got5Star){
  37.             totalCharWarps += 1;
  38.             got5Star = characterWarp(charPity);
  39.             charPity += 1;
  40.         }
  41.         charPity = 0;
  42.         gotE0 = rollFiveStar(charGuarantee ? 1 : 0.5);
  43.         if (!gotE0) charGuarantee = true;
  44.        
  45.     }
  46.     while(!gotS1){
  47.         let got5Star = false;
  48.         while (!got5Star){
  49.             totalConeWarps += 1;
  50.             got5Star = lightconeWarp(conePity);
  51.             conePity += 1;
  52.         }
  53.         conePity = 0;
  54.         gotS1 = rollFiveStar(coneGuarantee ? 1 : 0.75);
  55.         if (!gotS1) coneGuarantee = true;
  56.     }
  57.     return { "charWarps": totalCharWarps, "coneWarps": totalConeWarps };
  58. }
  59.  
  60. function simulate(runs){
  61.   let counter = 0;
  62.   let totalCharWarps = 0;
  63.   let totalConeWarps = 0;
  64.   while (counter < runs){
  65.     const { charWarps, coneWarps } = e0s1Trial();
  66.     totalCharWarps += charWarps;
  67.     totalConeWarps += coneWarps;
  68.     counter += 1;
  69.   }
  70.   return { "avgCharWarps": (totalCharWarps / runs), "avgConeWarps": (totalConeWarps / runs) };
  71. }
  72.  
  73. const results = simulate(100000)
  74. console.log(results);
Advertisement
Add Comment
Please, Sign In to add comment