带上幻想去冒险!

本WIKI编辑权限开放,数据均为人工整理,如发现内容缺失或错误,可在留言板处反馈,也可点击页面右上方的编辑按钮参与更新内容。
欢迎收藏起来防止迷路,也希望有爱的小伙伴加入我们哦~
WIKI编辑帮助幻塔WIKI留言板 • WIKI交流群:599132150

全站通知:

Widget:Wallet

来自幻塔WIKI_BWIKI_哔哩哔哩
跳到导航 跳到搜索

<!DOCTYPE html> <html lang="zh-CN"> <head>

   <meta charset="UTF-8">
   <meta name="viewport" content="width=device-width, initial-scale=1.0">
   <title>幻塔卡池模拟器</title>
   <style>
       .gacha-simulator {
           font-family: Arial, sans-serif;
           background-color: #2C3E50;
           color: white;
           padding: 20px;
           border-radius: 10px;
           width: 90%;
           max-width: 600px;
           margin: 20px auto;
           text-align: center;
       }
       .gacha-simulator h1 {
           font-size: 24px;
           margin-bottom: 20px;
       }
       .gacha-simulator label {
           display: block;
           margin: 10px 0;
           font-size: 16px;
       }
       .gacha-simulator input[type="number"],
       .gacha-simulator select {
           padding: 10px;
           width: 80%;
           max-width: 300px;
           border: none;
           border-radius: 5px;
           background-color: #34495E;
           color: white;
       }
       .gacha-simulator button {
           padding: 10px 20px;
           background-color: #3498DB;
           color: white;
           border: none;
           border-radius: 5px;
           cursor: pointer;
           margin: 10px 0;
       }
       .gacha-simulator button:hover {
           background-color: #2980B9;
       }
       .gacha-simulator .result {
           margin-top: 20px;
           font-size: 16px;
           background-color: #34495E;
           padding: 15px;
           border-radius: 5px;
           text-align: left;
       }
       .gacha-simulator .footer {
           margin-top: 20px;
           font-size: 14px;
           color: #BDC3C7;
       }
       .gacha-simulator .footer a {
           color: #3498DB;
           text-decoration: none;
       }
       .gacha-simulator .footer a:hover {
           text-decoration: underline;
       }
   </style>

</head> <body>

🌸 幻塔卡池模拟器 🌸

       <label for="history">历史记录(最近3次):</label>
       <select id="history">
           <option value="">请选择历史记录</option>
           <option value="中中歪">中中歪</option>
           <option value="中歪中">中歪中</option>
           <option value="中歪歪">中歪歪</option>
           <option value="歪中中">歪中中</option>
           <option value="歪中歪">歪中歪</option>
           <option value="歪歪中">歪歪中</option>
       </select>
       <label for="pulls">赤核数量:</label>
       <input id="pulls" type="number" placeholder="请输入你拥有的赤核数量">
       <label for="target">目标星级:</label>
       <select id="target">
           <option value="0">0星</option>
           <option value="1">1星</option>
           <option value="2">2星</option>
           <option value="3">3星</option>
           <option value="4">4星</option>
           <option value="5">5星</option>
           <option value="6">6星</option>
       </select>
       <button onclick="simulate()">开始模拟</button>
   <script>
       function parseHistory(historyStr) {
           const validChars = [...historyStr].filter(c => c === '中' || c === '歪').slice(-3);
           const state = { consecLimited: 0, consecStandard: 0 };
           for (const char of validChars.reverse()) {
               if (char === '中') {
                   state.consecLimited++;
                   state.consecStandard = 0;
               } else if (char === '歪') {
                   state.consecStandard++;
                   state.consecLimited = 0;
               }
           }
           return state;
       }

function simulateGacha(pulls, initState) {

   let currentState = { ...initState };
   let limitedCount = 0;
   let pityCounter = 0; // 保底计数器
   for (let i = 0; i < pulls; i++) {
       pityCounter++;
       let isTarget = false;
       if (pityCounter >= 80) {
           isTarget = Math.random() < 0.5; 
           pityCounter = 0;
       } else {
           const isHit = Math.random() < 0.0075;
           if (isHit) {
               if (currentState.consecStandard >= 2) {
                   isTarget = true;
                   currentState.consecStandard = 0;
                   currentState.consecLimited = 1;
               } else {
                   isTarget = Math.random() < 0.5;
               }
           }
       }
       if (isTarget) {
           limitedCount++;
           currentState.consecLimited++;
           currentState.consecStandard = 0;
       } else {
           currentState.consecStandard++;
           currentState.consecLimited = 0;
       }
   }
   return limitedCount;

}

       function calculateCoinExchange(totalPulls) {
           return Math.floor(totalPulls / 110);
       }
       function calculateSuccessRate(pulls, target, coinExchange, historyState) {
           let success = 0;
           for (let i = 0; i < 1000; i++) {
               const limitedCount = simulateGacha(pulls, historyState);
               if (limitedCount + coinExchange >= target) {
                   success += 1;
               }
           }
           return success / 1000;
       }
       function recommendTarget(totalPulls, targetStar, coinExchange, historyState) {
           const starToPulls = { 0: 1, 1: 2, 2: 3, 3: 4, 4: 5, 5: 6, 6: 7 };
           const targetPulls = starToPulls[targetStar];
           const successRate = calculateSuccessRate(totalPulls, targetPulls, coinExchange, historyState);
           let recommendation = `当前目标:${targetStar} 星(需抽 ${targetPulls} 把,综合成功率:${(successRate * 100).toFixed(1)}%)`;
           if (successRate < 0.5) {
               let lowerTarget = targetStar - 1;
               while (lowerTarget >= 0) {
                   // 跳过 2 星和 4 星
                   if (lowerTarget === 2 || lowerTarget === 4) {
                       lowerTarget--;
                       continue;
                   }
                   const lowerSuccessRate = calculateSuccessRate(totalPulls, starToPulls[lowerTarget], coinExchange, historyState);
                   if (lowerSuccessRate >= 0.5) {
                       recommendation += `
建议降档目标:${lowerTarget} 星(需抽 ${starToPulls[lowerTarget]} 把,成功率:${(lowerSuccessRate * 100).toFixed(1)}%)`; break; } lowerTarget--; } }
           return recommendation;
       }
       function simulate() {
           const history = document.getElementById('history').value;
           const pulls = parseInt(document.getElementById('pulls').value);
           const targetStar = parseInt(document.getElementById('target').value);
           if (!history || isNaN(pulls) || isNaN(targetStar)) {
               alert("请输入完整信息!");
               return;
           }
           const historyState = parseHistory(history);
           const coinExchange = calculateCoinExchange(pulls);
           const newLimited = simulateGacha(pulls, historyState);
           const recommendation = recommendTarget(pulls, targetStar, coinExchange, historyState);
           document.getElementById('result').innerHTML = `

铸币可兑换限定:${coinExchange}个

预计新增限定:${newLimited} ± 1个

${recommendation}

           `;
       }
   </script>

</body> </html>