游戏王残局简化版

Annotation For script/c0.lua
Login

Annotation For script/c0.lua

Lines of script/c0.lua from check-in 383ce45c59 that are changed by the sequence of edits moving toward check-in d64decbe1d:

                         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:   --~ 这一局所适用规则的对
                        23:   local k1
                        24:   k1 = {
                        25:     [3] = "大师规则三(2014) ",
                        26:     [4] = "新大师规则(2017) ",
                        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 k11 = 1, #d["排_效果卡之类型"] do
                        50:     if Card.IsType(card, d["排_效果卡之类型"][k11]) then
                        51:       return true
                        52:       end
                        53:     end
                        54:   if Card.IsType(card, TYPE_PENDULUM) then
                        55:     for k11 = 1, #d["排_非效果灵摆怪兽之卡片编号"] do
                        56:       if Card.IsCode(card, d["排_非效果灵摆怪兽之卡片编号"][k11]) then
                        57:         return false
                        58:       else
                        59:         end
                        60:       end
                        61:     return true
                        62:     end
                        63:   end
                        64: do
383ce45c59 2024-07-17   65:   --~ 量_开局选卡入手的数量
                        66:   local k1
                        67:   --~ 效果_所调用这个效果的效果
383ce45c59 2024-07-17   68:   --~ 玩家_所调用这个效果的玩家
383ce45c59 2024-07-17   69:   f["_开局选卡入手"] = function(o1, o2)
                        70:     --~ 卡_玩家选定的卡
                        71:     local k2
                        72:     k2 = Duel.SelectMatchingCard(o2, Card.IsAbleToHand, o2, LOCATION_DECK, 0, k1, k1, nil)
383ce45c59 2024-07-17   73:     local o2
383ce45c59 2024-07-17   74:     local k1
                        75:     Duel.SendtoHand(k2, nil, REASON_RULE)
383ce45c59 2024-07-17   76:     local k2
                        77:     o1:Reset()
383ce45c59 2024-07-17   78:     local o1
                        79:     end
383ce45c59 2024-07-17   80:   --~ 量_开局选卡入手的数量
383ce45c59 2024-07-17   81:   f["开局选卡入手"] = function(o1)
                        82:     --~ 效果
                        83:     local k2
383ce45c59 2024-07-17   84:     d["量_选卡"] = o1
                        85:     k1 = o1
                        86:     k2 = Effect.GlobalEffect()
                        87:     k2:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_CONTINUOUS)
                        88:     k2:SetCode(EVENT_ADJUST)
                        89:     k2:SetCondition(aux.TRUE)
383ce45c59 2024-07-17   90:     k2:SetOperation(f["_开局选卡入手"])
                        91:     Duel.RegisterEffect(k2, 0)
                        92:     end
                        93:   end
383ce45c59 2024-07-17   94: --~ 量_禁几个怪兽格
383ce45c59 2024-07-17   95: f["禁格"] = function(o1)
                        96:   local k1
383ce45c59 2024-07-17   97:   d["量_禁格"] = o1
383ce45c59 2024-07-17   98:   --~ 效果
                        99:   k1 = Effect.GlobalEffect()
                       100:   k1:SetCode(EFFECT_USE_EXTRA_MZONE)
                       101:   k1:SetValue(o1)
                       102:   Duel.RegisterEffect(k1, 0)
                       103:   end
                       104: do
                       105:   local k1, k2, k3, k4
383ce45c59 2024-07-17  106:   --~ 字_印卡过多时的提示
                       107:   k1 = "印卡过多"
383ce45c59 2024-07-17  108:   --~ 量_现在的印卡数量
                       109:   k2 = 1
383ce45c59 2024-07-17  110:   --~ 量_手卡印卡数量的上限
                       111:   k3 = 0
383ce45c59 2024-07-17  112:   --~ 量_印卡总数量的上限
                       113:   k4 = 0
                       114:   --~ 效果_所调用这个效果的效果
                       115:   --~ 数_所调用这个效果的玩家
                       116:   f["_印卡"] = function(o1, o2)
                       117:     local k5, k6
383ce45c59 2024-07-17  118:     --~ 数_要印之卡的卡编
                       119:     k5 = Duel.AnnounceCard(o2)
383ce45c59 2024-07-17  120:     --~ 卡
                       121:     k6 = Duel.CreateToken(o2, k5)
                       122:     if k2 <= k3 then
                       123:       k2 = k2 + 1
                       124:       Duel.SendtoHand(k6, nil, REASON_RULE)
                       125:     else
                       126:       if k2 <= k4 then
                       127:         k2 = k2 + 1
                       128:         Duel.SendtoDeck(k6, o2, 0, REASON_RULE)
                       129:       else
                       130:         Debug.ShowHint(k1)
                       131:         o1:Reset()
                       132:         end
                       133:       end
                       134:     end
                       135:   --~ 卡_印卡的启动源
                       136:   --~ 量_手卡印卡数量的上限
                       137:   --~ 量_印卡总数量的上限
                       138:   f["印卡"] = function(o1, o2, o3)
                       139:     local k5
                       140:     k3 = o2
                       141:     k4 = o3 or o2
                       142:     Debug.ShowHint("点击对方额外卡组,可以印卡\n手卡只能印" .. k3 .. "张\n最多可印" .. k4 .. "张")
                       143:     k5 = Effect.CreateEffect(o1)
                       144:     k5:SetType(EFFECT_TYPE_IGNITION)
                       145:     k5:SetProperty(EFFECT_FLAG_BOTH_SIDE + EFFECT_FLAG_UNCOPYABLE + EFFECT_FLAG_CANNOT_DISABLE)
                       146:     k5:SetTarget(f["不被连锁"])
                       147:     k5:SetRange(LOCATION_EXTRA)
                       148:     k5:SetOperation(f["_印卡"])
                       149:     o1:RegisterEffect(k5)
                       150:     end
                       151:   end
                       152: f["开局说明"] = function()
                       153:   --~ 字_开局说明
                       154:   --~ 量_我方的效果卡
                       155:   --~ 组_我方超量素材
                       156:   --~ 量_对方的效果卡
                       157:   --~ 组_对方超量素材
                       158:   --~ 量_效果卡
                       159:   local k1, k2, k3, k4, k5, k6
                       160:   k2 = Duel.GetMatchingGroupCount(f["是否有效果卡"], 0, d["数_所有区域"], nil, nil)
                       161:   k3 = Duel.GetOverlayGroup(0, LOCATION_MZONE, nil)
                       162:   for o1 in aux.Next(k3) do
                       163:     if f["是否有效果卡"](o1) then
                       164:       k2 = k2 + 1
                       165:       end
                       166:     end
                       167:   k4 = Duel.GetMatchingGroupCount(f["是否有效果卡"], 0, nil, d["数_所有区域"], nil)
                       168:   k5 = Duel.GetOverlayGroup(0, nil, LOCATION_MZONE)
                       169:   for o1 in aux.Next(k5) do
                       170:     if f["是否有效果卡"](o1) then
                       171:       k4 = k4 + 1
                       172:       end
                       173:     end
                       174:   k6 = k2 + k4
                       175:   k1 = "" .. k6 .. "卡 " .. k4 .. "卡 " .. d["字_这一局的规则"]
                       176:   if d["数_假洗卡"] == 0 then
                       177:   else
                       178:     k1 = k1 .. "假洗卡 "
                       179:     end
                       180:   if d["数_战斗阶段"] == 0 then
                       181:     k1 = k1 .. "无战斗阶段 "
                       182:     end
                       183:   if d["数_人工智能"] == 0 then
                       184:     k1 = k1 .. "无人工智能 "
                       185:     end
383ce45c59 2024-07-17  186:   if d["量_选卡"] then
383ce45c59 2024-07-17  187:     k1 = k1 .. "选" .. d["量_选卡"] .. "卡 "
                       188:     end
383ce45c59 2024-07-17  189:   if d["量_禁格"] then
383ce45c59 2024-07-17  190:     k1 = k1 .. "禁" .. d["量_禁格"] .. "格 "
                       191:     end
                       192:   Debug.ShowHint(k1)
                       193:   end
                       194: do
                       195:   f["aux.BeginPuzzle"] = _G.aux.BeginPuzzle
383ce45c59 2024-07-17  196:   --~ 量_开局选卡入手的数量
                       197:   --~ 量_禁几个我方主要怪兽格
                       198:   --~ 卡_传入对方额外卡组最上面的表侧卡,并将其作为印卡源
                       199:   --~ 量_能印几张手卡
                       200:   --~ 量_最多能印几张卡
                       201:   function _G.aux.BeginPuzzle(o1, o2, o3, o4, o5)
                       202:     f["aux.BeginPuzzle"]()
                       203:     if o1 then
383ce45c59 2024-07-17  204:       f["开局选卡入手"](o1)
                       205:     else
                       206:       end
                       207:     if o2 then
383ce45c59 2024-07-17  208:       f["禁格"](o2)
                       209:     else
                       210:       end
                       211:     if o3 then
                       212:       f["印卡"](o3, o4, o5)
                       213:     else
                       214:       end
                       215:     f["开局说明"]()
                       216:     end
                       217:   end
                       218: Auxiliary.PuzzleOp = function()
                       219:   Duel.SetLP(0,0)
                       220:   for i = 1, #d["排_局末提示"] do
                       221:     Debug.ShowHint(d["排_局末提示"][i])
                       222:     end
                       223:   end
                       224: do
                       225:   f["Debug.ReloadFieldEnd"] = _G.Debug.ReloadFieldEnd
                       226:   --~ 局末提示
                       227:   function _G.Debug.ReloadFieldEnd(...)
                       228:     f["Debug.ReloadFieldEnd"]()
                       229:     d["排_局末提示"] = {...}
                       230:     end
                       231:   end