用户:RedDragon/Test2:修订间差异
来自Rizline中文维基
更多操作
小 |
小 |
||
| 第139行: | 第139行: | ||
function generateRandomRestrictions() { | function generateRandomRestrictions() { | ||
const speeds = [...Array(20).fill("无限制"), ...Array.from({ length: 91 }, (_, i) => (i + 10) / 10)] | const speeds = [...Array(20).fill("无限制"), ...Array.from({ length: 91 }, (_, i) => (i + 10) / 10)] | ||
const mods = ["无MOD"] | const mods = ["无MOD", "镜像模式", "保护模式", "Bad保护模式", "隐藏计量条"] | ||
const others = ["无限制"] | const others = ["无限制"] | ||
document.getElementById('difficulty-data').innerHTML = window.difficultyArray[Math.floor(Math.random() * window.difficultyArray.length)] | document.getElementById('difficulty-data').innerHTML = window.difficultyArray[Math.floor(Math.random() * window.difficultyArray.length)] | ||
document.getElementById('speed-data').textContent = speeds[Math.floor(Math.random() * speeds.length)] | document.getElementById('speed-data').textContent = speeds[Math.floor(Math.random() * speeds.length)] | ||
document.getElementById(' | let selectedMods = [] | ||
if (Math.random() < 0.7) { | |||
selectedMods = [mods[Math.floor(Math.random() * mods.length)]] | |||
} else { | |||
const count = Math.floor(Math.random() * 3) + 2 // 2-4个 | |||
const shuffled = [...mods].sort(() => Math.random() - 0.5) | |||
selectedMods = shuffled.slice(0, count) | |||
if (selectedMods.includes("无MOD")) { | |||
selectedMods = ["无MOD"] | |||
} | |||
if (selectedMods.includes("特殊计量条")) { | |||
const specialRates = ["特殊计量条100%", "特殊计量条110%", "特殊计量条120%"] | |||
selectedMods = selectedMods.filter(m => m !== "特殊计量条") | |||
selectedMods.push(specialRates[Math.floor(Math.random() * specialRates.length)]) | |||
} | |||
} | |||
document.getElementById('mod-data').textContent = selectedMods.join(" + ") | |||
let selectedOthers = [] | |||
if (Math.random() < 0.8) { | |||
selectedOthers = [others[Math.floor(Math.random() * others.length)]] | |||
} else { | |||
const count = Math.floor(Math.random() * 2) + 2 | |||
const shuffled = [...others].sort(() => Math.random() - 0.5) | |||
selectedOthers = shuffled.slice(0, count) | |||
if (selectedOthers.includes("无限制")) { | |||
selectedOthers = ["无限制"] | |||
} | |||
} | |||
document.getElementById('other-data').textContent = selectedOthers.join(" + ") | |||
} | } | ||