模块

模块:词典

来自卡厄思梦境WIKI

律Rhyme留言 | 贡献2025年10月2日 (四) 15:39的版本

此模块的文档可以在模块:词典/doc创建

local p = {}

-- 卡牌机制词典数据
p.cardMechanics = {
    ["蒸发"] = "卡牌在回合结束时自动消耗",
    ["终极"] = "卡牌使用后结束当前回合",
    ["天上"] = "使用其他2费以上的卡,立即自动打出本卡",
    ["回收"] = "若此卡牌移动至弃牌堆,会回到手牌。发动效果时,移除回收",
    ["保留"] = "卡牌不会在回合结束时进入弃牌堆",
    ["唯一"] = "此卡牌无法复制",
    ["开战"] = "此卡牌在战斗开始时置于抽牌堆顶端",
    ["连击"] = "使用其他同伴的卡牌时,发动此卡牌",
    ["弱点攻击"] = "对韧性耗尽敌弱点伤害",
    ["快速"] = "使用卡牌时不会影响敌人的行动计数器",
    ["主导"] = "回合开始时,有50%的机率使本卡牌费用减少1<br>使用其他卡牌时,移除效果",
    ["储存"] = "保留费用,生效时层数减少1",
    ["金属化"] = "使用卡牌获得护盾时,对随机敌人造成80%的制伤害",
    ["消灭"] = "使用后消耗卡牌,不会进入弃牌堆,持续到战斗结束",
    ["封锁"] = "卡牌发动时不会触发效果<br>触发此卡牌后移除封锁",
    ["粉碎"] = "攻击持有护盾的目标时,伤害量+20%"
}

function p.main(frame)
    local args = frame:getParent().args
    local category = args[1] or ""
    local term = args[2] or ""
    local color = args["颜色"] or "black"
    
    -- 颜色映射
    local colorMap = {
        ["蓝"] = "#0066cc",
        ["红"] = "#cc0000",
        ["绿"] = "#00cc00",
        ["黄"] = "#cccc00",
        ["紫"] = "#9933cc"
    }
    
    local textColor = colorMap[color] or color
    
    -- 获取描述
    local description = ""
    if category == "卡牌机制" then
        description = p.cardMechanics[term] or "未找到描述"
    end
    
    -- 生成HTML
    local html = string.format([[
<span class="dictionary-term" style="color: %s; text-decoration: underline; cursor: help; position: relative; display: inline-block;">%s<span class="dictionary-tooltip" style="display: none; position: absolute; bottom: calc(100%% + 5px); left: 0; width: 200px; z-index: 1000;">
<div style="width: 200px; height: 2px; background-color: #f2ba02;"></div>
<div style="width: 200px; background-color: #343434; color: white; padding: 5px; box-shadow: 0 2px 8px rgba(0,0,0,0.3);">%s<br>%s</div>
</span></span>]], textColor, term, term, description)
    
    return html
end

return p