游戏王残局简化版

Annotation For script/c0.lua
Login

Annotation For script/c0.lua

Lines of script/c0.lua from check-in 72a706f479 that are changed by the sequence of edits moving toward check-in 221188e89a:

                         1: local string = string
                         2: local table = table
                         3: local Debug = Debug
                         4: local Effect = Effect
                         5: local Duel = Duel
                         6: local Card = Card
                         7: local d = {}
                         8: local f = {}
                         9: d["排_效果卡的类型"] = {
                        10:   TYPE_SPELL,
                        11:   TYPE_TRAP,
                        12:   TYPE_EFFECT,
                        13:   }
                        14: d["排_非效果灵摆怪兽的卡编"] = {
                        15:   28363749,
                        16:   19474136,
                        17:   17390179,
                        18:   83980492,
                        19:   }
                        20: d["数_所有区域"] = LOCATION_HAND + LOCATION_MZONE + LOCATION_SZONE + LOCATION_GRAVE + LOCATION_REMOVED + LOCATION_DECK + LOCATION_EXTRA
                        21: do
                        22:   local k1
                        23:   --~ 这一局所适用规则的对
                        24:   k1 = {
72a706f479 2024-06-27   25:     [3] = "大师规则 ",
72a706f479 2024-06-27   26:     [4] = "新大师规则(2017) ",
72a706f479 2024-06-27   27:     [5] = "大师规则(2020) ",
                        28:     }
                        29:   f["Debug.ReloadFieldBegin"] = _G.Debug.ReloadFieldBegin
                        30:   --~ 这一局的模式
                        31:   --~ 规则参数
                        32:   function _G.Debug.ReloadFieldBegin(o1, o2)
                        33:     d["数_假洗卡"] = o1 & DUEL_PSEUDO_SHUFFLE
                        34:     d["数_战斗阶段"] = o1 & DUEL_ATTACK_FIRST_TURN
                        35:     d["数_人工智能"] = o1 & DUEL_SIMPLE_AI
                        36:     if o2 then
                        37:       d["字_这一局的规则"] = k1[o2]
                        38:     else
                        39:       d["字_这一局的规则"] = k1[5]
                        40:       end
                        41:     f["Debug.ReloadFieldBegin"](o1, o2)
                        42:     end
                        43:   end
                        44: f["不被连锁"] = function()
                        45:   Duel.SetChainLimit(aux.FALSE)
                        46:   return true
                        47:   end
                        48: f["是否有效果卡"] = function(card)
                        49:   for i = 1, #d["排_非效果灵摆怪兽的卡编"] do
                        50:     if Card.IsCode(card, d["排_非效果灵摆怪兽的卡编"][i]) then
                        51:       return false
                        52:       end
                        53:     end
                        54:   return true
                        55:   end
                        56: do
                        57:   local k1
                        58:   --~ 所调用这个效果的效果
                        59:   --~ 所调用这个效果的玩家
                        60:   f["_开局选卡入手"] = function(o1, o2)
                        61:     local k2
                        62:     --~ 玩家选定的卡
                        63:     k2 = Duel.SelectMatchingCard(o2, Card.IsAbleToHand, o2, LOCATION_DECK, 0, k1, k1, nil)
                        64:     Duel.SendtoHand(k2, nil, REASON_RULE)
                        65:     o1:Reset()
                        66:     end
                        67:   f["开局选卡入手"] = function(o1)
                        68:     local k2
                        69:     d["数_选卡"] = o1
                        70:     --~ 开局选卡入手的数量
                        71:     k1 = o1
                        72:     --~ 效果
                        73:     k2 = Effect.GlobalEffect()
                        74:     k2:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_CONTINUOUS)
                        75:     k2:SetCode(EVENT_ADJUST)
                        76:     k2:SetCondition(aux.TRUE)
                        77:     k2:SetOperation(f["_开局选卡入手"])
                        78:     Duel.RegisterEffect(k2, 0)
                        79:     end
                        80:   end
                        81: --~ 禁几个怪兽格
                        82: f["禁格"] = function(o1)
                        83:   local k1
                        84:   d["数_禁格"] = o1
                        85:   --~ 效果
                        86:   k1 = Effect.GlobalEffect()
                        87:   k1:SetCode(EFFECT_USE_EXTRA_MZONE)
                        88:   k1:SetValue(o1)
                        89:   Duel.RegisterEffect(k1, 0)
                        90:   end
                        91: do
                        92:   local k1, k2, k3, k4
                        93:   --~ 印卡过多时的提示
                        94:   k1 = "印卡过多"
                        95:   --~ 现在的印卡数量
                        96:   k2 = 1
                        97:   --~ 手卡印卡数量的上限
                        98:   k3 = 0
                        99:   --~ 印卡总数量的上限
                       100:   k4 = 0
                       101:   --~ 所调用这个效果的效果
                       102:   --~ 所调用这个效果的玩家
                       103:   f["_印卡"] = function(o1, o2)
                       104:     local k5, k6
                       105:     --~ 要印之卡的卡编
                       106:     k5 = Duel.AnnounceCard(o2)
                       107:     --~ 卡
                       108:     k6 = Duel.CreateToken(o2, k5)
                       109:     if k2 <= k3 then
                       110:       k2 = k2 + 1
                       111:       Duel.SendtoHand(k6, nil, REASON_RULE)
                       112:     else
                       113:       if k2 <= k4 then
                       114:         k2 = k2 + 1
                       115:         Duel.SendtoDeck(k6, o2, 0, REASON_RULE)
                       116:       else
                       117:         Debug.ShowHint(k1)
                       118:         o1:Reset()
                       119:         end
                       120:       end
                       121:     end
                       122:   --~ 印卡的启动源
                       123:   --~ 手卡印卡数量的上限
                       124:   --~ 印卡总数量的上限
                       125:   f["印卡"] = function(o1, o2, o3)
                       126:     local k5
                       127:     k3 = o2
                       128:     k4 = o3 or o2
                       129:     Debug.ShowHint("点对方额外卡组,可印卡\n只能印手卡 " .. k3 .. " 张\n最多可印 " .. k4 .. " 张")
                       130:     k5 = Effect.CreateEffect(o1)
                       131:     k5:SetType(EFFECT_TYPE_IGNITION)
                       132:     k5:SetProperty(EFFECT_FLAG_BOTH_SIDE + EFFECT_FLAG_UNCOPYABLE + EFFECT_FLAG_CANNOT_NEGATE + EFFECT_FLAG_CANNOT_DISABLE)
                       133:     k5:SetTarget(f["不被连锁"])
                       134:     k5:SetRange(LOCATION_EXTRA)
                       135:     k5:SetOperation(f["_印卡"])
                       136:     o1:RegisterEffect(k5)
                       137:     end
                       138:   end
                       139: f["开局提示"] = function()
                       140:   local k1, k2, k3
                       141:   --~ 这一局的效果卡数量
                       142:   k2 = Duel.GetMatchingGroupCount(d["是否有效果卡"], 0, d["数_所有区域"], d["数_所有区域"], nil)
                       143:   --~ 超量素材的组
                       144:   k3 = Duel.GetOverlayGroup(0, LOCATION_MZONE, LOCATION_MZONE)
                       145:   for o1 in aux.Next(k3) do
                       146:     if d["是否有效果卡"](o1) then
                       147:       k2 = k2 + 1
                       148:       end
                       149:     end
                       150:   --~ 开局说明
                       151:   k1 = "" .. k2 .. "卡 " .. d["字_这一局的规则"]
                       152:   if d["数_假洗卡"] == 0 then
                       153:   else
72a706f479 2024-06-27  154:     k1 = k1 .. "假洗卡 "
                       155:     end
                       156:   if d["数_战斗阶段"] == 0 then
72a706f479 2024-06-27  157:     k1 = k1 .. "无战斗阶段 "
                       158:     end
                       159:   if d["数_人工智能"] == 0 then
72a706f479 2024-06-27  160:     k1 = k1 .. "无人工智能 "
                       161:     end
                       162:   if d["数_选卡"] then
72a706f479 2024-06-27  163:     k1 = k1 .. "选" .. d["数_选卡"] .. "卡 "
                       164:     end
                       165:   if d["数_禁格"] then
72a706f479 2024-06-27  166:     k1 = k1 .. "禁" .. d["数_禁格"] .. "怪格 "
                       167:     end
                       168:   Debug.ShowHint(k1)
                       169:   end
                       170: do
                       171:   f["aux.BeginPuzzle"] = _G.aux.BeginPuzzle
                       172:   --~ 开局选卡入手的数量
                       173:   --~ 禁几个我方主要怪兽格
                       174:   --~ 传入对方额外卡组最上面的表侧卡,并将其作为印卡源
                       175:   --~ 能印几张手卡
                       176:   --~ 最多能印几张卡
                       177:   function _G.aux.BeginPuzzle(o1, o2, o3, o4, o5)
                       178:     f["aux.BeginPuzzle"]()
                       179:     if o1 then
                       180:       f["开局选卡入手"](o1)
                       181:     else
                       182:       end
                       183:     if o2 then
                       184:       f["禁格"](o2)
                       185:       --~ Debug.ShowHint("2")
                       186:     else
                       187:       end
                       188:     if o3 then
                       189:       f["印卡"](o3, o4, o5)
                       190:     else
                       191:       end
                       192:     f["开局提示"]()
                       193:     end
                       194:   end