游戏王残局简化版

Annotation For script/c0.lua
Login

Annotation For script/c0.lua

Lines of script/c0.lua from check-in fbb83a06ea that are changed by the sequence of edits moving toward check-in 7c676b0c70:

                         1: local str = {}
                         2: local string = string
                         3: local table = table
                         4: local s = {}
                         5: _G.fun = {}
                         6: str["效果卡的种类表"] = {
                         7:   TYPE_SPELL,
                         8:   TYPE_TRAP,
                         9:   TYPE_EFFECT,
                        10: }
                        11: str["无效果灵摆怪兽表"] = {
                        12:   28363749,
                        13:   19474136,
                        14:   17390179,
                        15:   83980492,
                        16: }
                        17: local h1
                        18: --~ 区域
                        19: h1 = LOCATION_HAND + LOCATION_MZONE + LOCATION_SZONE + LOCATION_GRAVE + LOCATION_REMOVED
                        20: str["除卡组与额外卡组以外的区域"] = h1
                        21: h1 = h1 + LOCATION_DECK + LOCATION_EXTRA
                        22: str["所有区域"] = h1
                        23: --第一层-------------------------------
                        24: local cache_1
                        25: local cache_2
                        26: local cache_3
                        27: local cache_4
                        28: local cache_5
                        29: local cache_6
                        30: local cache_7
                        31: local cache_8
                        32: local cache_9
                        33: local _
                        34: fun["Debug.ReloadFieldBegin"] = Debug.ReloadFieldBegin
                        35: Debug.ReloadFieldBegin = function(u1, u2)
                        36:   str["不洗牌"] = u1 & DUEL_PSEUDO_SHUFFLE
                        37:   str["无BP"] = u1 & DUEL_ATTACK_FIRST_TURN
                        38:   str["无AI"] = u1 & DUEL_SIMPLE_AI
                        39:   str["规则表"] = {
                        40:     [3] = "大师3 ",
                        41:     [4] = "新大师 ",
                        42:     [5] = "大师2020 ",
                        43:   }
                        44:   if u2 then
                        45:     str["规则"] = str["规则表"][u2]
                        46:   else
                        47:     str["规则"] = str["规则表"][5]
                        48:   end
                        49:   fun["Debug.ReloadFieldBegin"](u1, u2)
                        50: end
fbb83a06ea 2024-02-13   51: function s["开局随机抽卡"](u1)
                        52:   local h1, h2
                        53:   s["开局洗卡抽卡之数"] = u1
                        54:   --~ 效果
                        55:   h1 = Effect.GlobalEffect()
                        56:   h1:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_CONTINUOUS)
                        57:   h1:SetCode(EVENT_ADJUST)
                        58:   h1:SetCondition(aux.TRUE)
                        59:   -- 随机抽卡
                        60:   --~ 调该效果的效果
                        61:   function h2(u2)
                        62:     Duel.ShuffleDeck(0)
                        63:     Duel.Draw(0, u1, REASON_RULE)
                        64:     u2:Reset()
                        65:     end
                        66:   h1:SetOperation(h2)
                        67:   Duel.RegisterEffect(h1, 0)
                        68:   end
                        69: fun["一_该效果不能被连锁"] = function()
                        70:   Duel.SetChainLimit(aux.FALSE)
                        71:   return true
                        72:   end
                        73: do
                        74:   local h1, h2
                        75:   --~ 原解邀请
                        76:   h1 = "残局群181175613"
                        77:   --~ 二解邀请,备用:圣魔术师
                        78:   h2 = "爆貘团:「你居然二解了,请加群告诉我怎么二解。」"
                        79:   function s["通关之邀"]()
                        80:     local h3, h4
                        81:     --~ 效果
                        82:     h3 = Effect.GlobalEffect()
                        83:     h3:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_CONTINUOUS)
                        84:     h3:SetCode(EVENT_DAMAGE)
                        85:     --~ 通关之邀
                        86:     function h4()
                        87:       local h5
                        88:       --~ 对方之血
                        89:       h5 = Duel.GetLP(1)
                        90:       if h5 <= 0 then
                        91:         if h5 == 0 then
                        92:           Debug.ShowHint(h1)
                        93:         else
                        94:           Debug.ShowHint(h2)
                        95:           end
                        96:       else
                        97:         return false
                        98:         end
                        99:       end
                       100:     h3:SetCondition(h4)
                       101:     h3:SetOperation(aux.NULL)
                       102:     Duel.RegisterEffect(h3, 0)
                       103:     end
                       104:   end
                       105: fun["一_是否效果卡"] = function(card)
                       106:   for i = 1, #str["效果卡的种类表"] do
                       107:     if Card.IsType(card, str["效果卡的种类表"][i]) then
                       108:       return true
                       109:     end
                       110:   end
                       111:   if Card.IsType(card, TYPE_PENDULUM) then
                       112:     for i = 1, #str["无效果灵摆怪兽表"] do
                       113:       if Card.IsCode(card, str["无效果灵摆怪兽表"][i]) then
                       114:       else
                       115:         return true
                       116:       end
                       117:     end
                       118:   end
                       119: end
                       120: function s["开局选卡入手"](u1)
                       121:   local h1, h2
                       122:   str["开局选卡入手之数"] = u1
                       123:   --~ 效果
                       124:   h1 = Effect.GlobalEffect()
                       125:   h1:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_CONTINUOUS)
                       126:   h1:SetCode(EVENT_ADJUST)
                       127:   h1:SetCondition(aux.TRUE)
                       128:   --~ 调该效果的效果
                       129:   --~ 调该效果的玩家
                       130:   function h2(u2, u3)
                       131:     local h3
                       132:     --~ 玩家选定的卡
                       133:     h3 = Duel.SelectMatchingCard(u3, Card.IsAbleToHand, u3, LOCATION_DECK, 0, u1, u1, nil)
                       134:     Duel.SendtoHand(h3, nil, REASON_RULE)
                       135:     u2:Reset()
                       136:     end
                       137:   h1:SetOperation(h2)
                       138:   Duel.RegisterEffect(h1, 0)
                       139:   end
                       140: function s["禁格"](u1)
                       141:   local h1
                       142:   s["禁格之数"] = u1
                       143:   --~ 效果
                       144:   h1 = Effect.GlobalEffect()
                       145:   h1:SetCode(EFFECT_USE_EXTRA_MZONE)
                       146:   h1:SetValue(u1)
                       147:   Duel.RegisterEffect(h1, 0)
                       148:   end
                       149: --第二层-------------------------------
                       150: local cache_1
                       151: local cache_2
                       152: local cache_3
                       153: local cache_4
                       154: local cache_5
                       155: local cache_6
                       156: local cache_7
                       157: local cache_8
                       158: local cache_9
                       159: local _
                       160: fun["Debug.ReloadFieldEnd"] = Debug.ReloadFieldEnd
                       161: Debug.ReloadFieldEnd = function(u1)
                       162:   fun["Debug.ReloadFieldEnd"]()
                       163:   if u1 then
fbb83a06ea 2024-02-13  164:     s["开局随机抽卡"](u1)
                       165:     end
                       166:   end
                       167: fun["二_印卡"] = function(u1, u2, u3)
                       168:   u3 = u3 or u2
                       169:   Debug.ShowHint(
                       170:     "点击对方额外卡组可以进行印卡。\n手卡只能印 "
                       171:       .. u2
                       172:       .. " 张。\n最多可以印 "
                       173:       .. u3
                       174:       .. " 张"
                       175:   )
                       176:   str["效果"] = Effect.CreateEffect(u1)
                       177:   str["当前印卡数"] = 1
                       178:   str["效果"]:SetType(EFFECT_TYPE_IGNITION)
                       179:   str["效果"]:SetProperty(
                       180:     EFFECT_FLAG_BOTH_SIDE + EFFECT_FLAG_UNCOPYABLE + EFFECT_FLAG_CANNOT_NEGATE + EFFECT_FLAG_CANNOT_DISABLE
                       181:   )
                       182:   str["效果"]:SetTarget(fun["一_该效果不能被连锁"])
                       183:   str["效果"]:SetRange(LOCATION_EXTRA)
                       184:   function print_hand(effect_event, player_who_activate_the_effect)
                       185:     announce_card = Duel.AnnounceCard(player_who_activate_the_effect)
                       186:     card = Duel.CreateToken(player_who_activate_the_effect, announce_card)
                       187:     if str["当前印卡数"] <= u2 then
                       188:       str["当前印卡数"] = str["当前印卡数"] + 1
                       189:       Duel.SendtoHand(card, nil, REASON_RULE)
                       190:     else
                       191:       if str["当前印卡数"] <= u3 then
                       192:         str["当前印卡数"] = str["当前印卡数"] + 1
                       193:         Duel.Remove(card, POS_FACEUP, REASON_RULE)
                       194:         Duel.SendtoDeck(card, player_who_activate_the_effect, 0, REASON_RULE)
                       195:       else
                       196:         Debug.ShowHint("印卡过多!")
                       197:         effect_event:Reset()
                       198:       end
                       199:     end
                       200:   end
                       201:   str["效果"]:SetOperation(print_hand)
                       202:   u1:RegisterEffect(str["效果"])
                       203: end
                       204: fun["二_开局说明"] = function()
                       205:   local h1
                       206:   str["这个残局的效果卡数量"] =
                       207:     Duel.GetMatchingGroupCount(fun["是否效果卡"], 0, str["所有区域"], str["所有区域"], nil)
                       208:   str["超量素材组"] = Duel.GetOverlayGroup(0, LOCATION_MZONE, LOCATION_MZONE)
                       209:   for k in aux.Next(str["超量素材组"]) do
                       210:     if fun["一_是否效果卡"](k) then
                       211:       str["这个残局的效果卡数量"] = str["这个残局的效果卡数量"] + 1
                       212:       end
                       213:     end
                       214:   --~ 开局说明
                       215:   h1 = str["这个残局的效果卡数量"] .. "卡 " .. str["规则"]
                       216:   if str["不洗牌"] == 0 then
                       217:   else
                       218:     h1 = h1 .. "伪洗牌 "
                       219:     end
                       220:   if str["无BP"] == 0 then
                       221:     h1 = h1 .. "无BP "
                       222:     end
                       223:   if str["无AI"] == 0 then
                       224:     h1 = h1 .. "无AI "
                       225:     end
                       226:   if s["开局选卡入手之数"] then
                       227:     h1 = h1 .. "选" .. s["开局选卡入手之数"] .. "卡 "
                       228:     end
                       229:   if s["禁格之数"] then
                       230:     h1 = h1 .. "禁" .. s["禁格之数"] .. "格 "
                       231:     end
                       232:   if s["开局洗卡抽卡之数"] then
                       233:     h1 = h1 .. "抽" .. s["开局洗卡抽卡之数"] .. "卡 "
                       234:     end
                       235:   Debug.ShowHint(h1)
                       236:   end
                       237: fun["aux.BeginPuzzle"] = aux.BeginPuzzle
                       238: aux.BeginPuzzle = function(u1, u2)
                       239:   fun["aux.BeginPuzzle"]()
                       240:   if u1 then
                       241:     s["开局选卡入手"](u1)
                       242:   end
                       243:   if u2 then
                       244:     s["禁格"](u2)
                       245:   end
                       246:   fun["二_开局说明"]()
                       247:   s["通关之邀"]()
                       248: end
                       249: --兼容层-------------------------------
                       250: fun["印卡"] = fun["二_印卡"]
                       251: fun["开局添加手卡"] = s["开局选卡入手"]
                       252: fun["是否效果卡"] = fun["一_是否效果卡"]
                       253: fun["禁格"] = s["禁格"]
                       254: fun["随机抽卡"] = s["开局洗卡抽卡"]