{"id":8,"date":"2025-10-27T15:00:57","date_gmt":"2025-10-27T07:00:57","guid":{"rendered":"https:\/\/www.alizhai.com\/?page_id=8"},"modified":"2025-10-27T15:00:57","modified_gmt":"2025-10-27T07:00:57","slug":"%e4%ba%94%e8%89%b2%e7%81%b5%e5%b0%98%e5%90%88%e6%88%90%e8%ae%a1%e7%ae%97%e5%99%a8","status":"publish","type":"page","link":"https:\/\/www.alizhai.com\/index.php\/%e4%ba%94%e8%89%b2%e7%81%b5%e5%b0%98%e5%90%88%e6%88%90%e8%ae%a1%e7%ae%97%e5%99%a8\/","title":{"rendered":"\u4e94\u8272\u7075\u5c18\u5408\u6210\u8ba1\u7b97\u5668"},"content":{"rendered":"\n<p class=\"calculator-container\">\n    <br\/>\n<\/p>\n<p class=\"calculator-title\">\n    \u4e94\u8272\u7075\u5c18\u5408\u6210\u8ba1\u7b97\u5668\n<\/p>\n<p class=\"calculator-form\">\n    <br\/>\n<\/p>\n<p class=\"calculator-label\">\n    \u8bf7\u8f93\u5165\u76ee\u6807\u7b49\u7ea7 (1-15):\n<\/p>\n<p>\n    <input type=\"number\" id=\"dustLevel\" min=\"1\" max=\"15\" value=\"5\" class=\"calculator-input\" onchange=\"initOwnedInputs()\"\/>\n<\/p>\n<p class=\"calculator-label\">\n    \u8bf7\u8f93\u51651\u7ea7\u4e94\u8272\u7075\u5c18\u5355\u4ef7 (\u53ef\u9009):\n<\/p>\n<p>\n    <input type=\"number\" id=\"dustPrice\" min=\"0\" step=\"0.01\" placeholder=\"\u8f93\u5165\u5355\u4ef7\u4ee5\u8ba1\u7b97\u4ef7\u683c\" class=\"calculator-input\"\/>\n<\/p>\n<p>\n    <button onclick=\"calculateDust()\" class=\"calculator-button\">\u8ba1\u7b97<\/button>\n<\/p>\n<p class=\"owned-inputs\">\n    <br\/>\n<\/p>\n<p class=\"calculator-subtitle\">\n    \u5df2\u62e5\u6709\u7684\u7075\u5c18\u6570\u91cf:\n<\/p>\n<p class=\"calculator-result\">\n    <br\/>\n<\/p>\n<p class=\"calculator-result-title\">\n    \u8ba1\u7b97\u7ed3\u679c (\u76ee\u6807\u7b49\u7ea7: <span id=\"resultLevel\">5<\/span>):\n<\/p>\n<p class=\"calculator-subtitle\" id=\"combinedSubtitle\">\n    \u7b49\u7ea7 5 \u8be6\u60c5\u4e0e1\u52305\u7ea7\u6c47\u603b:\n<\/p>\n<p class=\"table-responsive\"><\/p>\n<table class=\"calculator-table\" id=\"combinedTable\"><\/table>\n<p><\/p>\n<p id=\"priceSection\" class=\"calculator-price\" style=\"display:none\">\n    <br\/>\n<\/p><style>.calculator-container{max-width:1200px;margin:0 auto;padding:20px;font-family:Arial,sans-serif;background:#f5f5f5;border-radius:8px;box-shadow:0 2px 4px rgba(0,0,0,0.1)}\n.calculator-title{font-size:24px;font-weight:bold;margin-bottom:15px;color:#333;text-align:center}\n.calculator-form{margin-bottom:20px}\n.calculator-label{display:block;font-weight:bold}\n.calculator-input{width:100%;padding:7px;border:1px solid #ddd;border-radius:4px;box-sizing:border-box}\n.calculator-button{width:100%;padding:10px;background:#4CAF50;color:white;border:none;border-radius:4px;cursor:pointer;font-weight:bold;margin-top:10px}\n.calculator-button:hover{background:#45a049}\n.calculator-result{margin-top:20px;padding:15px;background:#e8f5e9;border-radius:4px}\n.calculator-result-title{font-weight:bold;margin-bottom:10px}\n.calculator-result-item{margin-bottom:5px}\n.calculator-table{width:100%;border-collapse:collapse;margin-top:15px}\n.calculator-table th,.calculator-table td{border:1px solid #ddd;padding:6px;text-align:left}\n.calculator-table th{background-color:#f2f2f2}\n.calculator-price{margin-top:15px;font-weight:bold}\n.calculator-subtitle{font-size:18px;font-weight:bold;margin-top:15px;margin-bottom:10px}\n.table-responsive{overflow-x:auto}\n.owned-inputs{margin-top:15px}\n.owned-inputs .input-group{display:flex;gap:10px;margin-bottom:10px}\n.owned-inputs .input-group input{flex:1}\n\/* \u6dfb\u52a0\u7f3a\u5c11\u7684\u989c\u8272\u6837\u5f0f\u5b9a\u4e49 *\/\n.color-red{color:red}\n.color-green{color:green}\n.single.indent p{text-indent: 0;margin-bottom: 0;}<\/style><script>\/\/ \u5c06sqrt2\u5b9a\u4e49\u79fb\u5230\u5168\u5c40\u4f5c\u7528\u57df\uff0c\u4f7f\u5176\u5728\u6240\u6709\u51fd\u6570\u4e2d\u90fd\u53ef\u8bbf\u95ee\nconst sqrt2 = Math.sqrt(2);\n\nfunction calculateDust() {\n    console.log('\u8ba1\u7b97\u6309\u94ae\u88ab\u70b9\u51fb'); \/\/ \u6dfb\u52a0\u65e5\u5fd7\u786e\u8ba4\u6309\u94ae\u4e8b\u4ef6\n    const level = parseInt(document.getElementById('dustLevel').value);\n    const priceInput = document.getElementById('dustPrice');\n    const price = priceInput.value.trim() === '' ? 0 : parseFloat(priceInput.value);\n    \n    if (isNaN(level) || level < 1 || level >15) {\n        alert('\u8bf7\u8f93\u5165\u6709\u6548\u7684\u7b49\u7ea7\uff081-15\uff09');\n        return;\n    }\n    \n    \/\/ \u66f4\u65b0\u76ee\u6807\u7b49\u7ea7\u663e\u793a\n    document.getElementById('resultLevel').textContent = level;\n    \n    \/\/ \u66f4\u65b0\u526f\u6807\u9898\u663e\u793a\n    document.getElementById('combinedSubtitle').textContent = `\u7b49\u7ea7 ${level} \u8be6\u60c5\u4e0e1\u5230${level}\u7ea7\u6c47\u603b:`;\n    \n    \/\/ \u83b7\u53d6\u5df2\u62e5\u6709\u7684\u7075\u5c18\u6570\u91cf\n    const ownedDust = {};\n    for (let i = 1; i <= 15; i++) {\n        const input = document.getElementById(`ownedLevel${i}`);\n        if (input) {\n            const value = parseInt(input.value) || 0;\n            ownedDust[i] = value;\n        }\n    }\n    \n    const results = calculateDustDetails(level, ownedDust);\n    displayResults(results, level, price, ownedDust);\n}\n\nfunction calculateDustDetails(targetLevel, ownedDust) {\n    const details = [];\n    \n    \/\/ \u8ba1\u7b97\u6bcf\u4e2a\u7b49\u7ea7\u7684\u6570\u636e\n    for (let i = 1; i <= targetLevel; i++) {\n        const single = Math.round(((Math.pow(1 + sqrt2, i) - Math.pow(1 - sqrt2, i)) \/ (2 * sqrt2)));\n        const total = Math.round(((Math.pow(1 + sqrt2, i + 1) + Math.pow(1 - sqrt2, i + 1) - 2) \/ 4));\n        \n        \/\/ \u8ba1\u7b97\u5df2\u62e5\u6709\u7684\u7b49\u4ef71\u7ea7\u7075\u5c18\u6570\u91cf\n        let ownedValueInLevel1 = 0;\n        for (const level in ownedDust) {\n            if (level >= i) continue; \/\/ \u53ea\u8003\u8651\u4f4e\u4e8e\u5f53\u524d\u7b49\u7ea7\u7684\u7075\u5c18\n            \n            const levelValue = Math.round(((Math.pow(1 + sqrt2, level) - Math.pow(1 - sqrt2, level)) \/ (2 * sqrt2)));\n            ownedValueInLevel1 += ownedDust[level] * levelValue;\n        }\n        \n        \/\/ \u8ba1\u7b97\u8fd8\u9700\u8981\u76841\u7ea7\u7075\u5c18\u6570\u91cf\uff08\u8003\u8651\u5df2\u62e5\u6709\u7684\uff09\n        let remaining = Math.max(0, single - ownedValueInLevel1);\n        \n        \/\/ \u8ba1\u7b97\u9700\u8981\u7684\u4f53\u529b\n        const stamina = calculateStamina(i);\n        const staminaValue = (stamina \/ 40) * 0.3;\n        \n        \/\/ \u8ba1\u7b971\u5230\u5f53\u524d\u7b49\u7ea7\u603b\u9700\u8981\u4f53\u529b\n        const totalStamina = calculateTotalStamina(i);\n        \n        details.push({\n            level: i,\n            single: single,\n            total: total,\n            ownedValueInLevel1: ownedValueInLevel1,\n            remaining: remaining,\n            stamina: stamina,\n            staminaValue: staminaValue,\n            totalStamina: totalStamina\n        });\n    }\n    \n    return details;\n}\n\nfunction calculateStamina(n) {\n    \/\/ \u5b9e\u73b0\u63d0\u4f9b\u7684\u4f53\u529b\u8ba1\u7b97\u516c\u5f0f\n    const term1 = Math.round(((Math.pow(1 + sqrt2, n + 1) - Math.pow(1 - sqrt2, n + 1)) \/ (2 * sqrt2)));\n    const term2 = Math.round(((Math.pow(1 + sqrt2, n) - Math.pow(1 - sqrt2, n)) \/ (2 * sqrt2)));\n    return 15 * (2 * term1 - term2 - n - 2);\n}\n\nfunction calculateTotalStamina(n) {\n    \/\/ \u65b0\u516c\u5f0f\uff1aROUND(15\/4*((5+3*SQRT(2))*POWER(1+SQRT(2),\u7b49\u7ea7)+(5-3*SQRT(2))*POWER(1-SQRT(2),\u7b49\u7ea7))-15\/2*(\u7b49\u7ea7^2+5*\u7b49\u7ea7+5),0)\n    const term1 = (5 + 3 * sqrt2) * Math.pow(1 + sqrt2, n);\n    const term2 = (5 - 3 * sqrt2) * Math.pow(1 - sqrt2, n);\n    const part1 = (15\/4) * (term1 + term2);\n    const part2 = (15\/2) * (Math.pow(n, 2) + 5 * n + 5);\n    return Math.round(part1 - part2);\n}\n\n\/\/ \u683c\u5f0f\u5316\u4ef7\u683c\u663e\u793a\uff0c\u53d6\u6574\u5e76\u53bb\u6389\u5c0f\u6570\u70b9\u540e\u76840\nfunction formatPrice(price) {\n    if (price === 0) return '-';\n    return Math.round(price).toString();\n}\n\nfunction displayResults(results, targetLevel, price, ownedDust) {\n    console.log('\u5f00\u59cb\u663e\u793a\u7ed3\u679c'); \/\/ \u6dfb\u52a0\u65e5\u5fd7\u786e\u8ba4\u51fd\u6570\u6267\u884c\n    const combinedTable = document.getElementById('combinedTable');\n    const priceSection = document.getElementById('priceSection');\n    \n    \/\/ \u6e05\u7a7a\u8868\u683c\n    combinedTable.innerHTML = '';\n    \n    \/\/ \u83b7\u53d6\u76ee\u6807\u7b49\u7ea7\u7684\u7ed3\u679c\n    const targetResult = results[results.length - 1];\n    \n    \/\/ \u8ba1\u7b971\u5230\u76ee\u6807\u7b49\u7ea7\u603b\u5171\u9700\u8981\u7684\u4ef7\u683c\n    let totalNeededDust = targetResult.total;\n    let ownedDustValue = 0;\n    \n    \/\/ \u8ba1\u7b97\u5df2\u62e5\u6709\u7684\u6240\u6709\u7075\u5c18\u7684\u7b49\u4ef71\u7ea7\u6570\u91cf\n    for (const level in ownedDust) {\n        const levelValue = Math.round(((Math.pow(1 + sqrt2, level) - Math.pow(1 - sqrt2, level)) \/ (2 * sqrt2)));\n        ownedDustValue += ownedDust[level] * levelValue;\n    }\n    \n    \/\/ \u8ba1\u7b97\u8fd8\u9700\u8981\u76841\u7ea7\u7075\u5c18\u603b\u6570\n    let totalRemaining = Math.max(0, totalNeededDust - ownedDustValue);\n    let totalRemainingPrice = totalRemaining * price;\n    \n    \/\/ \u8ba1\u7b971\u5230\u76ee\u6807\u7b49\u7ea7\u7684\u603b\u4f53\u529b\u4ef7\u503c\n    let totalStaminaValue = (targetResult.totalStamina \/ 40) * 0.3;\n    \n    \/\/ \u8ba1\u7b97\u5f53\u524d\u7b49\u7ea7\u5171\u9700\u4ef7\u683c\n    const currentLevelTotalPrice = targetResult.single * price;\n    \n    \/\/ \u521b\u5efa\u5408\u5e76\u540e\u7684\u8868\u683c - \u56db\u5217\u5e03\u5c40\uff08\u79fb\u9664\u4e86\u76ee\u6807\u7b49\u7ea7\u884c\uff09\n    let combinedRows = `<tr><th colspan=\"2\">\u7b49\u7ea7 ${targetLevel} \u8be6\u60c5<\/th><th colspan=\"2\">1\u5230${targetLevel}\u7ea7\u6c47\u603b<\/th><\/tr><tr><td>\u5408\u6210\u5f53\u524d\u7b49\u7ea7\u6240\u97001\u7ea7\u6570\u91cf<\/td><td>${targetResult.single}<\/td><td>1\u5230${targetLevel}\u7ea7\u603b\u8ba1\u6240\u97001\u7ea7\u6570\u91cf<\/td><td>${targetResult.total}<\/td><\/tr><tr><td>\u8fd8\u97001\u7ea7\u6570\u91cf<\/td><td class=\"${targetResult.remaining >0 ? 'color-red' : 'color-green'}\">${targetResult.remaining}<\/td><td>1\u5230${targetLevel}\u7ea7\u8fd8\u97001\u7ea7\u6570\u91cf<\/td><td class=\"${totalRemaining >0 ? 'color-red' : 'color-green'}\">${totalRemaining}<\/td><\/tr><tr><td>\u8fd8\u9700MHB<\/td><td class=\"${targetResult.remaining * price >0 ? 'color-red' : 'color-green'}\">${price > 0 ? formatPrice(targetResult.remaining * price) : '-'}<\/td><td>1\u5230${targetLevel}\u7ea7\u8fd8\u9700MHB<\/td><td class=\"${totalRemainingPrice >0 ? 'color-red' : 'color-green'}\">${price > 0 ? formatPrice(totalRemainingPrice) : '-'}<\/td><\/tr><tr><td>\u5408\u6210\u5f53\u524d\u7b49\u7ea7\u9700\u8981\u4f53\u529b<\/td><td>${targetResult.stamina}<\/td><td>1\u5230${targetLevel}\u7ea7\u603b\u9700\u8981\u4f53\u529b<\/td><td>${targetResult.totalStamina}<\/td><\/tr><tr><td>\u5408\u6210\u5f53\u524d\u7b49\u7ea7\u4f53\u529b\u4ef7\u503c(\u4e07)<\/td><td>${targetResult.staminaValue.toFixed(2)}<\/td><td>1\u5230${targetLevel}\u7ea7\u603b\u9700\u8981\u4f53\u529b\u4ef7\u503c(\u4e07)<\/td><td>${totalStaminaValue.toFixed(2)}<\/td><\/tr><tr><td>${targetLevel}\u7ea7\u5171\u9700\u4ef7\u683c<\/td><td>${price > 0 ? formatPrice(currentLevelTotalPrice) : '-'}<\/td><td>1\u5230${targetLevel}\u7ea7\u5171\u9700\u4ef7\u683c<\/td><td>${price > 0 ? formatPrice(targetResult.total * price) : '-'}<\/td><\/tr>`;\n    combinedTable.innerHTML = combinedRows;\n    \n    \/\/ \u9690\u85cf\u539f\u6765\u7684\u4ef7\u683c\u6c47\u603b\u533a\u57df\n    priceSection.style.display = 'none';\n}\n\n\/\/ \u9875\u9762\u52a0\u8f7d\u65f6\u521d\u59cb\u5316\u8868\u683c\u548c\u5df2\u62e5\u6709\u8f93\u5165\u6846\ndocument.addEventListener('DOMContentLoaded', function() {\n    console.log('DOM\u52a0\u8f7d\u5b8c\u6210'); \/\/ \u6dfb\u52a0\u65e5\u5fd7\u786e\u8ba4DOM\u52a0\u8f7d\n    \/\/ \u521d\u59cb\u5316\u5df2\u62e5\u6709\u6570\u91cf\u7684\u8f93\u5165\u6846\n    initOwnedInputs();\n    calculateDust(); \/\/ \u9ed8\u8ba4\u8ba1\u7b97\u4e00\u6b21\n});\n\nfunction initOwnedInputs() {\n    const container = document.getElementById('ownedInputsContainer');\n    container.innerHTML = '';\n    \n    const maxLevel = Math.min(parseInt(document.getElementById('dustLevel').value) || 5, 15);\n    \n    for (let i = 1; i <= maxLevel; i++) {\n        const inputGroup = document.createElement('div');\n        inputGroup.className = 'input-group';\n        inputGroup.innerHTML = `<label class=\"calculator-label\" for=\"ownedLevel${i}\">\u7b49\u7ea7 ${i} \u5df2\u62e5\u6709\u6570\u91cf:<\/label><input type=\"number\" id=\"ownedLevel${i}\" min=\"0\" value=\"0\" class=\"calculator-input\">`;\n        container.appendChild(inputGroup);\n    }\n}\n\n\/\/ \u5f53\u76ee\u6807\u7b49\u7ea7\u6539\u53d8\u65f6\uff0c\u66f4\u65b0\u5df2\u62e5\u6709\u6570\u91cf\u7684\u8f93\u5165\u6846\ndocument.getElementById('dustLevel').addEventListener('change', function() {\n    if (this.value > 15) {\n        this.value = 15;\n    }\n    initOwnedInputs();\n    \/\/ \u5f53\u7b49\u7ea7\u6539\u53d8\u65f6\u81ea\u52a8\u8ba1\u7b97\n    calculateDust();\n});<\/script>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4e94\u8272\u7075\u5c18\u5408\u6210\u8ba1\u7b97\u5668 \u8bf7\u8f93\u5165\u76ee\u6807\u7b49\u7ea7 (1-15): \u8bf7\u8f93\u51651\u7ea7\u4e94\u8272\u7075\u5c18\u5355\u4ef7 (\u53ef\u9009): \u8ba1\u7b97 \u5df2\u62e5\u6709\u7684\u7075\u5c18\u6570\u91cf [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-8","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/www.alizhai.com\/index.php\/wp-json\/wp\/v2\/pages\/8","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.alizhai.com\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.alizhai.com\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.alizhai.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.alizhai.com\/index.php\/wp-json\/wp\/v2\/comments?post=8"}],"version-history":[{"count":1,"href":"https:\/\/www.alizhai.com\/index.php\/wp-json\/wp\/v2\/pages\/8\/revisions"}],"predecessor-version":[{"id":9,"href":"https:\/\/www.alizhai.com\/index.php\/wp-json\/wp\/v2\/pages\/8\/revisions\/9"}],"wp:attachment":[{"href":"https:\/\/www.alizhai.com\/index.php\/wp-json\/wp\/v2\/media?parent=8"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}