模块:统计:修订间差异
无编辑摘要 标签:移动版编辑 移动版网页编辑 |
无编辑摘要 |
||
第1行: | 第1行: | ||
stats = {} | stats = {} | ||
rarities = { 'Common', 'Unusual', 'Rare', 'Epic', 'Legendary', 'Mythic', ' | rarities = { 'Common', 'Unusual', 'Rare', 'Epic', 'Legendary', 'Mythic', 'Ultimate', 'Supreme', 'Aracont' } for i, v in ipairs(rarities) do rarities[v] = i end | ||
cards = setmetatable({}, { __call = function (cards, args) | cards = setmetatable({}, { __call = function (cards, args) |
2024年12月23日 (一) 21:44的最新版本
可在模块:统计/doc创建此模块的帮助文档
stats = {} rarities = { 'Common', 'Unusual', 'Rare', 'Epic', 'Legendary', 'Mythic', 'Ultimate', 'Supreme', 'Aracont' } for i, v in ipairs(rarities) do rarities[v] = i end cards = setmetatable({}, { __call = function (cards, args) args = mw.text.split(args, ' ') name, initialrarity, shop, description = args[1], rarities[args[2]] and args[2] or rarities[1], rarities[args[2]] and tonumber(args[3]) or tonumber(args[2]), tonumber(args[3]) and table.concat(args, ' ', 4) or tonumber(args[2]) or rarities[args[2]] and table.concat(args, ' ', 3) or table.concat(args, ' ', 2) table.insert(cards, {name, initialrarity, shop, description }) --[[ (function (name, ...) card = {} a = Card.attributes for i = 1, math.ceil(#{...} / (#rarity + 1)) do a[#a + 1] = {} b = ({...})[(i - 1) * (#rarity + 1) + 1] a[b] = a[#a] for j = 1, #rarity do a[#a][j] = ({...})[(i - 1) * (#rarity + 1) + j + 1] end end card[#card + 1], card[name] = Card, Card end)(unpack(mw.text.split(s, ' '))) ]] end }) --format: card'<name> <Initial rarity> <Description> <Attribute> <Common card's stat> <Unusual's / Common's> Etc.' cards'Exp Common 1.5 随处可见的经验球,可以为你生产经验 经验生产速度 0.00005 2 3 4 6 nil 16 nil nil' cards'Coin Common 1.5 一枚神奇的金币,可以为你生产硬币 硬币生产速度 0.00005 2 3 4 6 nil 16 nil nil' stats.cards = cards mob = {} shop = { Exp = 1.5, Coin = 1.5 } return stats