欢迎来到气球塔防6 BWIKI!
除特殊说明外,本站内容采用CC BY-NC-SA 4.0协议。
欢迎各位到留言板留言或者加入QQ群:950568164

全站通知:

Widget:BloonCalculator

来自气球塔防6WIKI_BWIKI_哔哩哔哩
跳到导航 跳到搜索

用于计算每一回合的气球的数据

具体实现详见气球计算器

<div style="display: flex;">难度:<form id="difficulty" onchange="updateBloon()"><input type="radio" name="option" value="1" checked></input>简单<input type="radio" name="option" value="1.1"></input>普通<input type="radio" name="option" value="1.25"></input>困难</form></div><p></p>气球:<select id="bloon" onchange="updateBloon()"><option value="Red">红气球</option><option value="Blue">蓝气球</option><option value="Green">绿气球</option><option value="Yellow">黄气球</option><option value="Pink">粉气球</option><option value="Black">黑气球</option><option value="White">白气球</option><option value="Purple">紫气球</option><option value="Zebra">斑马气球</option><option value="Lead">铅气球</option><option value="Rainbow">彩虹气球</option><option value="Ceramic">陶瓷气球</option><option value="Moab">MOAB</option><option value="Bfb">BFB</option><option value="Zomg">ZOMG</option><option value="Ddt">DDT</option><option value="Bad">BAD</option></select><p></p>回合:<input id="round" min="1" max="2147483647" step="1" type="number" value="1" onchange="updateBloon()"></input><p></p>属性:<input id="camo" type="checkbox" onchange="updateBloon()"></input>迷彩&nbsp;<input id="regrow" type="checkbox" onchange="updateBloon()"></input>重生&nbsp;<input id="fortified" type="checkbox" onchange="updateBloon()"></input>强化&nbsp;<p></p><table class="wikitable"><tr><th>层数</th><td id="layer">1</td><td id="bloonimage" rowspan="11"><img id="img" src="https://wiki.biligame.com/btd6/特殊:重定向/file/Red.png"></img></td></tr><tr><th>子气球</th><td id="children"><b>N/A</b></td></tr><tr><th>外壳HP</th><td id="hp">1</td></tr><tr><th>垂直HP</th><td id="vhp">1</td></tr><tr><th>HP倍率</th><td id="hpx">100%</td></tr><tr><th>RBE</th><td id="rbe">1</td></tr><tr><th>损失生命</th><td id="leakdamage">1</td></tr><tr><th>速度</th><td id="speed">25</td></tr><tr><th>速度倍率</th><td id="speedx">100%</td></tr><tr><th>金币</th><td id="cash">1</td></tr><tr><th>金币倍率</th><td id="cashx">100%</td></tr></table><script>
    const blimps = ["Moab", "Bfb", "Zomg", "Ddt", "Bad"]
    const canFortified = ["Lead", "Ceramic"].concat(blimps)
    const bloonSpeeds = {
        "Red": 25, "Blue": 35, "Green": 45, "Yellow": 80, "Pink": 87.5, "Black": 45, "White": 50, "Purple": 75,
        "Zebra": 45, "Lead": 25, "Rainbow": 55, "Ceramic": 62.5, "Moab": 25, "Bfb": 6.25, "Zomg": 4.5, "Ddt": 66, "Bad": 4.5
    }
    // [[{children}],hp,cash]
    const bloonChildren = {
        "Red": [null, 1, 1],
        "Blue": [[{ 'Red': 1 }], 1, 2],
        "Green": [[{ 'Blue': 1 }], 1, 3],
        "Yellow": [[{ 'Green': 1 }], 1, 4],
        "Pink": [[{ 'Yellow': 1 }], 1, 5],
        "Black": [[{ 'Pink': 2 }], 1, 11],
        "White": [[{ 'Pink': 2 }], 1, 11],
        "Purple": [[{ 'Pink': 2 }], 1, 11],
        "Zebra": [[{ 'Black': 1 }, { 'White': 1 }], 1, 23],
        "Lead": [[{ 'Black': 2 }], 1, 23],
        "Rainbow": [[{ 'Zebra': 2 }], 1, 47],
        "Ceramic": [[{ 'Rainbow': 2 }], 10, 95],
        "Moab": [[{ 'Ceramic': 4 }], 200, 381],
        "Bfb": [[{ 'Moab': 4 }], 700, 1525],
        "Zomg": [[{ 'Bfb': 4 }], 4000, 6101],
        "Ddt": [[{ 'Ceramic': 4 }], 400, 381],
        "Bad": [[{ 'Zomg': 2 }, { 'Ddt': 3 }], 20000, 13346]
    }
    const bloonChildrenPost80 = {
        "Red": [null, 1, 1],
        "Blue": [[{ 'Red': 1 }], 1, 2],
        "Green": [[{ 'Blue': 1 }], 1, 3],
        "Yellow": [[{ 'Green': 1 }], 1, 4],
        "Pink": [[{ 'Yellow': 1 }], 1, 5],
        "Black": [[{ 'Pink': 1 }], 1, 6],
        "White": [[{ 'Pink': 1 }], 1, 6],
        "Purple": [[{ 'Pink': 1 }], 1, 6],
        "Zebra": [[{ 'Black': 1 }], 1, 7],
        "Lead": [[{ 'Black': 1 }], 1, 7],
        "Rainbow": [[{ 'Zebra': 1 }], 1, 8],
        "Ceramic": [[{ 'Rainbow': 1 }], 60, 95],
        "Moab": [[{ 'Ceramic': 4 }], 200, 381],
        "Bfb": [[{ 'Moab': 4 }], 700, 1525],
        "Zomg": [[{ 'Bfb': 4 }], 4000, 6101],
        "Ddt": [[{ 'Ceramic': 4 }], 400, 381],
        "Bad": [[{ 'Zomg': 2 }, { 'Ddt': 3 }], 20000, 13346]
    }
    const layers = {
        "Red": 1, "Blue": 2, "Green": 3, "Yellow": 4, "Pink": 5, "Black": 6, "White": 6, "Purple": 6,
        "Zebra": 7, "Lead": 7, "Rainbow": 8, "Ceramic": 9, "Moab": 10, "Bfb": 11, "Zomg": 12, "Ddt": 10, "Bad": 13
    }
    const translations = {
        "Red": "红", "Blue": "蓝", "Green": "绿", "Yellow": "黄", "Pink": "粉", "Black": "黑", "White": "白", "Purple": "紫",
        "Zebra": "斑马", "Lead": "铅", "Rainbow": "彩虹", "Ceramic": "陶瓷", "Moab": "MOAB", "Bfb": "BFB", "Zomg": "ZOMG", "Ddt": "DDT", "Bad": "BAD"
    }
    const getCashMultiplier = function (round) {
        if (round <= 50) return 1
        if (round <= 60) return 0.5
        if (round <= 85) return 0.2
        if (round <= 100) return 0.1
        if (round <= 120) return 0.05
        return 0.02
    }
    const getHPMultiplier = function (round, bloon) {
        if (!blimps.includes(bloon)) return 1
        let result = 1
        if (round > 80) result = 1 + (round - 80) * 0.02
        if (round > 100) result = 1.4 + (round - 100) * 0.05
        if (round > 124) result = 2.6 + (round - 124) * 0.15
        if (round > 150) result = 6.5 + (round - 150) * 0.35
        if (round > 250) result = 41.5 + (round - 250) * 1
        if (round > 300) result = 91.5 + (round - 300) * 1.5
        if (round > 400) result = 241.5 + (round - 400) * 2.5
        if (round > 500) result = 491.5 + (round - 500) * 5
        return result
    }
    const getSpeedMultiplier = function (round) {
        if (round <= 80) return 1
        let result = 1 + (round - 80) * 0.02
        if (round >= 101) result += 0.18
        if (round >= 151) result += 0.4
        if (round >= 201) result += 0.5
        if (round >= 252) result += 0.48
        return result
    }
    const changeChildren = function (bloon, camo, regrow, fortified, round) {
        if (bloon === 'Red') {
            document.getElementById('children').innerHTML = '<b>N/A</b>'
            return null
        }
        if (bloon === 'Ddt') {
            document.getElementById('children').innerHTML = '迷彩重生' + (fortified ? '强化' : '') + '陶瓷气球×4'
            return [{ 'Ceramic': 4 }]
        }
        let bloons = round > 80 ? bloonChildrenPost80[bloon][0] : bloonChildren[bloon][0]
        let result = []
        document.getElementById('children').innerHTML = (
            bloons.map((v, i) => {
                let name = Object.keys(v)[0]
                let isChildFortified = fortified && canFortified.includes(name)
                result.push(v)
                return (camo ? '迷彩' : '')
                    + (regrow ? '重生' : '')
                    + (isChildFortified ? '强化' : '')
                    + translations[name]
                    + (blimps.includes(name) ? '' : '气球')
                    + '×' + v[name].toString()
            }).join('<br>')
        )
        return result
    }
    const changePic = function (bloon, isCamo, isRegrow, isFortified) {
        let filename = blimps.includes(bloon) ? (bloon + (isFortified ? "Fortified" : "") + "Icon") : (
            bloon + ((!blimps.includes(bloon) && isRegrow) ? "Regrow" : "")
            + ((canFortified.includes(bloon) && isFortified) ? "Fortified" : "")
            + ((!blimps.includes(bloon) && isCamo) ? "Camo" : "")
        )
        document.getElementById('img').src = "https://wiki.biligame.com/btd6/特殊:重定向/file/" + filename + ".png"
    }
    const changeCheckboxes = function (bloon) {
        if (bloon === "Ddt") {
            document.getElementById('camo').checked = true
            document.getElementById('camo').disabled = true
        } else if (blimps.includes(bloon)) {
            document.getElementById('camo').checked = false
            document.getElementById('camo').disabled = true
        } else {
            document.getElementById('camo').disabled = false
        }
        if (blimps.includes(bloon)) {
            document.getElementById('regrow').disabled = true
            document.getElementById('regrow').checked = false
        } else {
            document.getElementById('regrow').disabled = false
        }
        if (canFortified.includes(bloon)) {
            document.getElementById('fortified').disabled = false
        } else {
            document.getElementById('fortified').disabled = true
            document.getElementById('fortified').checked = false
        }
    }
    const changeSpeed = function (bloon, round, diff) {
        let mult = getSpeedMultiplier(round)
        let speed = bloonSpeeds[bloon] * mult
        document.getElementById('speed').innerText = Math.round(speed * diff * 100000)/100000
        document.getElementById('speedx').innerText = Math.round(mult * 100)
        document.getElementById('speedx').innerText += "%"
    }
    const changeCash = function (bloon, round) {
        let mult = getCashMultiplier(round)
        document.getElementById('cashx').innerText = mult * 100
        document.getElementById('cashx').innerText += "%"
        let cash = round > 80 ? bloonChildrenPost80[bloon][2] : bloonChildren[bloon][2]
        document.getElementById('cash').innerText = Math.round(cash * mult * 100)/100
    }
    //[hp,vhp,rbe,hplost]
    const getHP = function (bloon, round, fortified) {
        if (bloon == 'Red') return [1, 1, 1, 1]
        let mult = getHPMultiplier(round, bloon)
        let stats = round > 80 ? bloonChildrenPost80 : bloonChildren
        let hp = 0, vhp = 0, rbe = 0, leak = 0
        let vhps = []
        stats[bloon][0].map((v, i) => {
            let name = Object.keys(v)[0]
            let number = v[name]
            let isChildFortified = fortified && canFortified.includes(name)
            let hps = getHP(name, round, isChildFortified)
            vhps.push(hps[1])
            rbe += hps[2] * number
            leak += hps[3] * number
        })
        if (fortified) {
            hp = mult * stats[bloon][1] * (bloon === 'Lead' ? 4 : 2)
        } else {
            hp = mult * stats[bloon][1]
        }
        vhp += Math.max(...vhps) + hp
        rbe += hp
        if (bloon === 'Ceramic' && round > 80) {
            leak += fortified ? (47 + 10 + 10) : (47 + 10)
        } else if (bloon === 'Lead') {
            leak += stats[bloon][1] * (fortified ? 4 : 1)
        } else {
            leak += stats[bloon][1] * (fortified ? 2 : 1)
        }
        return [hp, vhp, rbe, leak]
    }
    const changeRBE = function (bloon, fortified, round) {
        let mult = getHPMultiplier(round, bloon)
        document.getElementById('hpx').innerText = Math.round(mult * 100)
        document.getElementById('hpx').innerText += "%"
        let hps = getHP(bloon, round, fortified)
        document.getElementById('hp').innerText = Math.round(hps[0])
        document.getElementById('vhp').innerText = Math.round(hps[1])
        document.getElementById('rbe').innerText = Math.round(hps[2])
        document.getElementById('leakdamage').innerText = hps[3]
    }
    const changeLayer = function (bloon) {
        document.getElementById('layer').innerText = layers[bloon]
    }
    const updateBloon = function () {
        let bloon = document.querySelector('select#bloon').value
        changeCheckboxes(bloon)
        let isCamo = document.getElementById('camo').checked
        let isRegrow = document.getElementById('regrow').checked
        let isFortified = document.getElementById('fortified').checked
        let speedDifficulty = parseFloat(document.querySelector('input[name="option"]:checked').value)
        let round = parseInt(document.getElementById('round').value)
        changeLayer(bloon)
        changePic(bloon, isCamo, isRegrow, isFortified)
        changeSpeed(bloon, round, speedDifficulty)
        changeCash(bloon, round)
        let children = changeChildren(bloon, isCamo, isRegrow, isFortified, round)
        changeRBE(bloon, isFortified, round)
    }
    updateBloon()
</script>