用户:RedDragon/Test2:修订间差异
来自Rizline中文维基
更多操作
小 |
小 |
||
| 第30行: | 第30行: | ||
<th scope="row" class="infobox-label" style="width:90px;background:#ddf;">其他</th> | <th scope="row" class="infobox-label" style="width:90px;background:#ddf;">其他</th> | ||
<td class="infobox-data" id="other-data">d</td> | <td class="infobox-data" id="other-data">d</td> | ||
</tr> | |||
<tr class="infobox-below" style="display:none;"> | |||
<td colspan="2" style="padding:0.5em;text-align:center;">e</td> | |||
</tr> | </tr> | ||
</tbody> | </tbody> | ||
| 第92行: | 第95行: | ||
const rows = wikitext.split('|-') | const rows = wikitext.split('|-') | ||
for ( | for (const row of rows.slice(1)) { | ||
const columns = row.split('\n').filter(function (col) { return col.trim().startsWith('|') }) | const columns = row.split('\n').filter(function (col) { return col.trim().startsWith('|') }) | ||
| 第203行: | 第205行: | ||
var headerElement = document.querySelector('.infobox-header th') | var headerElement = document.querySelector('.infobox-header th') | ||
var labelElements = document.querySelectorAll('.infobox-label') | var labelElements = document.querySelectorAll('.infobox-label') | ||
var belowElement = document.querySelector('.infobox-below') | |||
titleElement.textContent = song.title | titleElement.textContent = song.title | ||
| 第216行: | 第219行: | ||
} | } | ||
belowElement.style.background = data.labelBg || '#B2E9FE' | |||
belowElement.style.color = data.labelColor || '#000000' | |||
// 更新图片 | |||
var container = document.querySelector('.infobox td[colspan="2"]') | var container = document.querySelector('.infobox td[colspan="2"]') | ||
container.innerHTML = | container.innerHTML = `<a href="${data.pageUrl}" target="_blank"><img id="song-image" width="300" height="300" src="${data.imageUrl || '/images/thumb/4/41/插画图标.png/300px-插画图标.png'}"></a>` | ||
window.difficultyArray = [ | window.difficultyArray = [ | ||
| 第231行: | 第238行: | ||
function createDiffSpan(diff, level) { | function createDiffSpan(diff, level) { | ||
var colors = { EZ: '#57E4C4', HD: '#FDBA61', IN: '#FE8661' } | var colors = { EZ: '#57E4C4', HD: '#FDBA61', IN: '#FE8661' } | ||
return | return `<span style="width:max-content;text-align:center;display:inline-block;border-radius:1em;color:white;background:${colors[diff]};padding:0 0.80em;margin:0.1em 0.50em">${diff} ${level}</span>` | ||
} | } | ||
function generateRandomRestrictions() { | function generateRandomRestrictions() { | ||
// | // 流速选项 | ||
var speeds = Array(40).fill("无限制").concat(Array.from({ length: 91 }, function (_, i) { return (i + 10) / 10 })) | var speeds = Array(40).fill("无限制").concat(Array.from({ length: 91 }, function (_, i) { return (i + 10) / 10 })) | ||
// 随机流速 | // 随机流速 | ||
| 第246行: | 第253行: | ||
var modOptions = [ | var modOptions = [ | ||
{ name: "无MOD", weight: 4 }, | { name: "无MOD", weight: 4 }, | ||
{ name: "镜像模式", weight: | { name: "无限制", weight: 4 }, | ||
{ name: "保护模式", weight: | { name: "观赏模式", weight: 1 }, | ||
{ name: "Bad保护模式", weight: | { name: "镜像模式", weight: 2 }, | ||
{ name: "特殊计量条", weight: | { name: "保护模式", weight: 2 }, | ||
{ name: "隐藏计量条", weight: | { name: "Bad保护模式", weight: 2 }, | ||
{ name: "特殊计量条", weight: 2, exclude: ["特殊计量条100%", "特殊计量条110%", "特殊计量条120%"] }, | |||
{ name: "特殊计量条100%", weight: 2, exclude: ["特殊计量条", "特殊计量条110%", "特殊计量条120%"] }, | |||
{ name: "特殊计量条110%", weight: 2, exclude: ["特殊计量条", "特殊计量条100%", "特殊计量条120%"] }, | |||
{ name: "特殊计量条120%", weight: 2, exclude: ["特殊计量条", "特殊计量条100%", "特殊计量条110%"] }, | |||
{ name: "隐藏计量条", weight: 2 } | |||
] | ] | ||
| 第257行: | 第269行: | ||
{ name: "无限制", weight: 12 }, | { name: "无限制", weight: 12 }, | ||
{ name: "静音", weight: 2 }, | { name: "静音", weight: 2 }, | ||
{ name: "单手", weight: 2 }, | { name: "单手", weight: 2, exclude: ["全拆打法", "全换打法"] }, | ||
{ name: "手持", weight: 2 }, | { name: "手持", weight: 2 }, | ||
{ name: "Bad数比Hit数多", weight: 1 }, | { name: "Bad数比Hit数多", weight: 1 }, | ||
{ name: "Combo低于50", weight: 1 }, | { name: "Combo低于50", weight: 1 }, | ||
{ name: "全拆打法", weight: 2 }, | { name: "全拆打法", weight: 2, exclude: ["单手"] }, | ||
{ name: "全换打法", weight: 2 }, | { name: "全换打法", weight: 2, exclude: ["单手"] }, | ||
{ name: "禁止出张", weight: 2 }, | { name: "禁止出张", weight: 2 }, | ||
{ name: "反色", weight: 1 } | { name: "反色", weight: 1 } | ||
| 第268行: | 第280行: | ||
// 随机MOD | // 随机MOD | ||
var selectedMods = | var selectedMods = selectWeightedItemsWithExclude(modOptions, 0.3, ["无MOD", "无限制", "观赏模式"]) | ||
// 随机其他限制 | // 随机其他限制 | ||
var selectedOthers = | var selectedOthers = selectWeightedItemsWithExclude(otherOptions, 0.8, ["无限制"]) | ||
updateRestrictionElement('mod-data', selectedMods) | updateRestrictionElement('mod-data', selectedMods) | ||
updateRestrictionElement('other-data', selectedOthers) | updateRestrictionElement('other-data', selectedOthers) | ||
updateBelowText(selectedDifficulty, selectedSpeed, selectedMods, selectedOthers) | |||
} | } | ||
// | // 加权随机选择函数,逐个检查冲突 | ||
// options: 选项数组 | // options: 选项数组 | ||
// singleProbability: 只选择一个项的概率 | // singleProbability: 只选择一个项的概率 | ||
// excludeItem: 选择多个时要排除的项 | // excludeItem: 选择多个时要排除的项 | ||
function | function selectWeightedItemsWithExclude(options, singleProbability, excludeItems) { | ||
var selectedItems = [] | var selectedItems = [] | ||
| 第301行: | 第306行: | ||
selectedItems = [weightedOptions[Math.floor(Math.random() * weightedOptions.length)]] | selectedItems = [weightedOptions[Math.floor(Math.random() * weightedOptions.length)]] | ||
} else { | } else { | ||
var availableOptions = options.filter(function (opt) { return opt.name | var availableOptions = options.filter(function (opt) { | ||
var | return !excludeItems.includes(opt.name) | ||
}) | |||
var weightedOptions = [] | |||
for (var i = 0; i < availableOptions.length; i++) { | |||
for (var j = 0; j < availableOptions[i].weight; j++) { | |||
weightedOptions.push(availableOptions[i]) | |||
} | |||
} | |||
var count = Math.floor(Math.random() * 3) + 2 // 2-4个项 | var count = Math.floor(Math.random() * 3) + 2 // 2-4个项 | ||
selectedItems = | var maxAttempts = 20 | ||
while (selectedItems.length < count && weightedOptions.length > 0 && maxAttempts > 0) { | |||
maxAttempts-- | |||
var randomIndex = Math.floor(Math.random() * weightedOptions.length) | |||
var candidate = weightedOptions[randomIndex] | |||
var canAdd = true | |||
for (var j = 0; j < selectedItems.length; j++) { | |||
var selectedItem = selectedItems[j] | |||
if (candidate.exclude) { | |||
if (candidate.exclude.includes(selectedItem)) { | |||
canAdd = false | |||
break | |||
} | |||
} | |||
var selectedOption = availableOptions.find(function (opt) { return opt.name === selectedItem }) | |||
if (selectedOption) { | |||
if (selectedOption.exclude) { | |||
if (selectedOption.exclude.includes(candidate.name)) { | |||
canAdd = false | |||
break | |||
} | |||
} | |||
} | |||
} | |||
if (canAdd) { | |||
selectedItems.push(candidate.name) | |||
weightedOptions = weightedOptions.filter(function (opt) { return opt.name !== candidate.name }) | |||
} else { | |||
weightedOptions.splice(randomIndex, 1) | |||
} | |||
} | |||
} | } | ||
if (selectedItems.includes( | for (var i = 0; i < excludeItems.length; i++) { | ||
if (selectedItems.includes(excludeItems[i])) { | |||
selectedItems = [excludeItems[i]] | |||
break | |||
} | |||
} | } | ||
| 第323行: | 第374行: | ||
} | } | ||
function updateBelowText(difficulty, speed, mods, others) { | |||
var belowElement = document.querySelector('.infobox-below') | |||
var belowText = "" | |||
if (mods.length === 1) { | |||
if (mods[0] === "观赏模式") { | |||
belowText = "WOW奖励关!" | |||
} | |||
}else if (difficulty.includes('EZ')) { | |||
if (speed === "无限制") { | |||
if (mods.length === 1) { | |||
if (mods[0] === "无限制") { | |||
if (others.length === 1) { | |||
if (others[0] === "无限制") { | |||
belowText = "最简单的一集" | |||
} | |||
} | |||
} | |||
} | |||
} | |||
}else if (difficulty.includes('AT')) { | |||
belowText = "这么强?!" | |||
} | |||
if (belowText) { | |||
belowElement.style.display = "" | |||
belowElement.querySelector('td').textContent = belowText | |||
} else { | |||
belowElement.style.display = "none" | |||
} | |||
} | |||
</script> | </script> | ||
</html> | </html> | ||
| 第328行: | 第410行: | ||
神秘的随机挑战! | 神秘的随机挑战! | ||
Ver.1. | Ver.1.6 | ||
<html> | <html> | ||
| 第345行: | 第427行: | ||
|titlestyle = background:#ccc | |titlestyle = background:#ccc | ||
|image = [[File:插画图标.png|100px]] | |image = [[File:插画图标.png|100px]] | ||
|headerstyle = background:#ccf | |headerstyle = background:#ccf | ||
|labelstyle = background:#ddf | |labelstyle = background:#ddf | ||
| 第358行: | 第439行: | ||
|label5 = 其他 | |label5 = 其他 | ||
|data5 = d | |data5 = d | ||
| | |||
|belowstyle = background:#ddf; | |||
|below = e | |||
}} | }} | ||
2025年10月23日 (四) 00:20的版本
| 曲目 | |
|---|---|
|
|
|
| 限制 | |
| 难度 | a |
| 流速 | b |
| MOD | c |
| 其他 | d |
神秘的随机挑战!
Ver.1.6
{{Infobox
|name = 随机挑战
|title = 曲目
|titlestyle = background:#ccc
|image = [[File:插画图标.png|100px]]
|headerstyle = background:#ccf
|labelstyle = background:#ddf
|header1 = 限制
|label2 = 难度
|data2 = a
|label3 = 流速
|data3 = b
|label4 = MOD
|data4 = c
|label5 = 其他
|data5 = d
|belowstyle = background:#ddf;
|below = e
}}
User:RedDragon/Test User:RedDragon/Test1 User:RedDragon/Test2