Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function lightconeWarp(pity){
- if (pity >= 80) return true;
- if (pity >= 66){
- const odds = 0.8 + (7* (pity-65))
- return (Math.random() < (odds / 100))
- }
- return (Math.random() < 0.008);
- }
- function characterWarp(pity){
- if (pity >= 90) return true;
- if (pity >= 74){
- const odds = 0.6 + (6* (pity-73))
- return (Math.random() < (odds / 100))
- }
- return (Math.random() < 0.006);
- }
- function rollFiveStar(rateUp){
- if (Math.random() < rateUp) return true;
- const pool = [true, false, false, false, false, false, false, false];
- return pool[Math.floor(Math.random() * pool.length)]
- }
- function e0s1Trial(){
- let gotE0 = false;
- let gotS1 = false;
- let charPity = 0;
- let conePity = 0;
- let charGuarantee = false;
- let coneGuarantee = false;
- let totalCharWarps = 0;
- let totalConeWarps = 0;
- while(!gotE0){
- let got5Star = false;
- while (!got5Star){
- totalCharWarps += 1;
- got5Star = characterWarp(charPity);
- charPity += 1;
- }
- charPity = 0;
- gotE0 = rollFiveStar(charGuarantee ? 1 : 0.5);
- if (!gotE0) charGuarantee = true;
- }
- while(!gotS1){
- let got5Star = false;
- while (!got5Star){
- totalConeWarps += 1;
- got5Star = lightconeWarp(conePity);
- conePity += 1;
- }
- conePity = 0;
- gotS1 = rollFiveStar(coneGuarantee ? 1 : 0.75);
- if (!gotS1) coneGuarantee = true;
- }
- return { "charWarps": totalCharWarps, "coneWarps": totalConeWarps };
- }
- function simulate(runs){
- let counter = 0;
- let totalCharWarps = 0;
- let totalConeWarps = 0;
- while (counter < runs){
- const { charWarps, coneWarps } = e0s1Trial();
- totalCharWarps += charWarps;
- totalConeWarps += coneWarps;
- counter += 1;
- }
- return { "avgCharWarps": (totalCharWarps / runs), "avgConeWarps": (totalConeWarps / runs) };
- }
- const results = simulate(100000)
- console.log(results);
Advertisement
Add Comment
Please, Sign In to add comment